note 86755 deleted from function.str-split by danbrown
| From: | danbrown@php.net | Date: | Sun, 02 Nov 2008 14:46:32 +0000 |
| Subject: | note 86755 deleted from function.str-split by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146042@lists.php.net to get a copy of this message | ||
Note Submitter: luruke
----
My implementation of str_split():
<?php
function __strlen($string){
$i=0; while(isset($string[$i])) $i++;
return $i;
}
function __str_split($string, $split_lenght=0){
for($array=array(),$j=0,$i=0; $i<__strlen($string); $i++){
$array[$j] .= $string[$i];
if(__strlen($array[$j]) >= $split_lenght) $j++;
}
return $array;
}
print_r(__str_split("ciao amici",3));
?>