note 70797 added to function.str-split
| From: | webmaster at nsssa dot ca | Date: | Sat, 28 Oct 2006 14:45:40 +0000 |
| Subject: | note 70797 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119211@lists.php.net to get a copy of this message | ||
I noticed in the post below me that his function would return an array with an empty key at the end.
So here is just a little fix for it.
<?php
//Create a string split function for pre PHP5 versions
function str_split($str, $nr) {
//Return an array with 1 less item then the one we have
return array_slice(split("-l-", chunk_split($str, $nr, '-l-')), 0, -1);
}
?>
----
Server IP: 66.207.199.35
Probable Submitter: 24.89.236.235
----
Manual Page -- http://www.php.net/manual/en/function.str-split.php
Edit -- https://master.php.net/note/edit/70797
Del: integrated -- https://master.php.net/note/delete/70797/integrated
Del: useless -- https://master.php.net/note/delete/70797/useless
Del: bad code -- https://master.php.net/note/delete/70797/bad+code
Del: spam -- https://master.php.net/note/delete/70797/spam
Del: non-english -- https://master.php.net/note/delete/70797/non-english
Del: in docs -- https://master.php.net/note/delete/70797/in+docs
Del: other reasons-- https://master.php.net/note/delete/70797
Reject -- https://master.php.net/note/reject/70797
Search -- https://master.php.net/manage/user-notes.php