note 84891 deleted from function.str-split by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 18:31:35 +0000 |
| Subject: | note 84891 deleted from function.str-split by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218691@lists.php.net to get a copy of this message | ||
Note Submitter: rrelmy
----
revised function from tatsudoshi
Fixed some bugs, more php5 style compliant
<?php
if(!function_exists('str_split')) {
function str_split($string,$string_length=1) {
if(strlen($string)>$string_length || !$string_length) {
do {
$c = strlen($string);
$parts[] = substr($string,0,$string_length);
$string = substr($string,$string_length);
} while($string !== false);
} else {
$parts = array($string);
}
return $parts;
}
}
?>