note 62854 deleted from function.str-split by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 17:57:38 +0000 |
| Subject: | note 62854 deleted from function.str-split by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218674@lists.php.net to get a copy of this message | ||
Note Submitter: heavyraptor
----
I think that the last post by carlosreche at yahoo dot com is too complicated.
It's much easier if you do it like this:
<?php
if (!function_exists("str_split")) {
function str_split($str,$length = 1) {
if ($length < 1) return false;
$strlen = strlen($str);
$ret = array();
for ($i = 0; $i < $strlen; $i += $length) {
$ret[] = substr($str,$i,$length);
}
return $ret;
}
}
?>
I hope it helps for those with PHP <5