Martin Holm wrote:
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);
here, you can also use:
$arr[] = $str{$i};
and use $i++ instead of $i += $size
if you don't need strings larger than 1 character.
}
return $arr;
}
}
?>
works in about the same way as the function in php5.
|
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php