1
I have the following string in a given array:
[est] => INA1C4A1
I need to divide into sets:
[0] => Array
(
[mov] => IN
[seq] => Array
(
[0] => A1
[1] => C4
[2] => A1
)
its easy!, but the problem is that the "A1" can be "A11", so I thought divide into sets until the first character appears:
for($i=0;$i<sizeof($arr_res);$i++){
$aux[$i][mov] = substr($arr_res[$i][cod], 0, 2);
$aux_mov = substr($arr_res[$i][codigo], 2, strlen($arr_res[$i][codigo])-1);
$aux[$i][seq] = preg_split('/(?=[0-9]+)/',$aux_mov,3);
}
the result is not as expected:
[0] => Array
(
[mov] => IN
[seq] => Array
(
[0] => A
[1] => 1C
[2] => 4A1
)
This is the problem '/(?=[0-9]+)/'?
"IN" (mov) is what? How is it to extract?
– Miguel
@Miguel The "IN" is already extracted in " $aux[$i][mov] = substr($arr_res[$i][Cod], 0, 2); "my question is " preg_split "
– Gomez