i have string like this
$string = '$foo$wow$123$$$ok$';
i want to return empty string and save string in array like this
0 = foo
1 = wow
2 = 123
3 =
4 =
5 = ok
i use PREG_SPLIT_NO_EMPTY
, i know when make PREG_SPLIT_NO_EMPTY
return is not empty, but i want any result empty, i want my result save in variable array like in PREG_SPLIT_NO_EMPTY
with $chars[$i];
this is my preg_split :
$chars = preg_split('/[\s]*[$][\s]*/', $string, -1, PREG_SPLIT_NO_EMPTY);
for($i=0;$i<=5;$i++){
echo $i.' = '.$chars[$i];
}
i want, my result show with looping. no in object loop i want pure this looping:
for($i=0;$i<=5;$i++){
echo $i.' = '.$chars[$i];
}
to show my result.
how i use this preg_split, thanks for advance...