note 43923 deleted from function.str-split by aidan
| From: | aidan@php.net | Date: | Thu, 26 Aug 2004 23:16:01 +0000 |
| Subject: | note 43923 deleted from function.str-split by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75384@lists.php.net to get a copy of this message | ||
Note Submitter: kxh5qNO at SPAMyahoo dot com
----
Let's improve on sleek's version - adding error check for split length.
<?php
function str_split($str, $len=1)
{
if ($len < 1) return false;
$tmp_str = array();
for ($offset = 0; $offset < strlen($str); $offset += $len)
{
$tmp_str[] = substr($str, $offset, $len);
}
return $tmp_str;
}
?>