note 33921 added to function.str-split
| From: | funnykindaguy at yahoo dot com | Date: | Fri, 11 Jul 2003 03:53:30 +0000 |
| Subject: | note 33921 added to function.str-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51879@lists.php.net to get a copy of this message | ||
The following function will do the exact same thing (from PHP 3.0.6 and up), is just as simple to
use and only takes two lines!
function jpm_split($string, $split_length=1, $separator=':') {
return explode($separator, chunk_split($string, $split_length, $separator));
}
It works the same way and has the same parameters with the addition of "separator". This
optional parameter is necessary in case you know that your string already contains the default
separator ':' in it. In which case you would simply change it to any other safe character
in order for the function to work properly.
* In my previous submission I accidentally spelt "separator" as "seperator"
which caused the explode function not to work. I apologize for this mistake.
----
Manual Page -- http://www.php.net/manual/en/function.str-split.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33921
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33921&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33921&report=yes