note 35608 added to function.str-split
| From: | NOSPAM at rn2 dot php dot net | Date: | Mon, 08 Sep 2003 11:11:35 +0000 |
| Subject: | note 35608 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55786@lists.php.net to get a copy of this message | ||
Again, an emulation of str_split for older versions just like the above, only in simpler code
(should work with php3 and 4, I guess...):
function str_split($str,$num = '1') {
if($num < 1) return FALSE;
$arr = array();
for ($j = 0; $j < strlen($str); $j= $j+$num) {
$arr[] = substr($str,$j,$num);
}
return $arr;
}
----
Manual Page -- http://www.php.net/manual/en/function.str-split.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35608
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35608&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35608&report=yes