I have the following string in a particular array:
[est] => INA1C4A1
I need to split into sets:
[0] => Array
(
[mov] => IN
[seq] => Array
(
[0] => A1
[1] => C4
[2] => A1
)
its easy! , but the problem is that "A1" can be "A11", so I thought I'd split into sets until the first character appeared:
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
)
Is this the problem '/ (? = [0-9] +) /' ?