mkoenig
1
Anyone have a clue how to explode a number if there are no spaces or identifying characters in it?
example.
1234567
i want into an array
1
2
3
4
5
6
7
Ive used php explode, but since there is no space, comma, dash or other identifying “thing” i cannot seem to do it.
Any other ideas?
Thanks
use str_split
$split = str_split('1234567');
mkoenig
5
Thanks works like a charm man.
system
6
You don’t have to split, because it’s an array already.
In a way
while($num=$str[$i++]) echo $num;
That depends on what he wants to do with it.
If it’s just accessing individual characters, then yes you can use array notation to access individual characters from the string.
If however he actually requires an array for some other function or circumstance, then the str_split method become invaluable.
system
8
Thank you, Capt. Obvious! 