I'm using this code to get first number and replace it with 0-9, but I always get 0-0-9 result. Then I deleted in array 9 it started to work correct. why it works that way ?
$direction = strtoupper(substr($query_row["Band"],0,1));
$replace = [
'0' => '0-9','1' => '0-9','2' => '0-9','3' => '0-9','4' => '0-9',
'5' => '0-9','6' => '0-9','7' => '0-9','8' => '0-9', '9' => '0-9' ];
$dir= str_replace(array_keys($replace), $replace, $direction);
$replace = [ ,'0'0 => 0-9and then9 => 0-9which means 0 becomec 0-0-9 Searching for a solution please wait$direction. If you have more than 1 number it will replace all of these, not only the first one. Please give an example for$directionand an expected result.$directiontoo. Along with expected output