[thelist] preg_split in PHP
noah
noah at tookish.net
Mon Jan 14 19:34:03 CST 2002
I'm trying to use preg_split (or split) to split a string in PHP. The
string is just a number (e.g., 2457) and I want to split it into individual
digits.
When I use
$acts = preg_split('//', '2457');
$number_of_acts = (count($acts));
$number_of_acts comes back as 6.
So I tried using PREG_SPLIT_NO_EMPTY, like this:
$acts = preg_split('//', '2457', PREG_SPLIT_NO_EMPTY);
$number_of_acts = (count($acts));
Now $number_of_acts comes back as 1.
I'm using PHP 4.0b2 (if that means anything).
Anyone have any idea what I might be doing wrong, or how I might accomplish
what I'm trying to do?
Thanks,
Noah
More information about the thelist
mailing list