Re: Splitting 12345 -> 1,2,3,4,5
| From: | Martin Holm | Date: | Thu, 16 Sep 2004 07:32:12 +0000 |
| Subject: | Re: Splitting 12345 -> 1,2,3,4,5 | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-196831@lists.php.net to get a copy of this message | ||
Michael Mao wrote:
Thanks John. Found what I'm looking for: Function str_split() to make it php4 compatible you can use this function:|<?php if (!function_exists('str_split')) { function str_split ($str, $size = 1) {
$arr = array();
for ($i = 0 ; $i < strlen($str) ; $i += $size) {
$arr[] = substr($str,$i,$size);
}
return $arr;
}
}
?>
works in about the same way as the function in php5.
|