note 70634 added to function.explode
| From: | bait at clabs dot ru | Date: | Sun, 22 Oct 2006 15:57:23 +0000 |
| Subject: | note 70634 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118978@lists.php.net to get a copy of this message | ||
I used to spend 2 hours at deep night to solve such a simple problem. I needed function that
explodes strings using more than one separator. The solution was very simple.
// str - string to explode
// separators - Array of separator strings
// $separator = Array ( 0=> ' ',
// 1 => ',',
// 2 => '.',
// 3 => ':'
// )
function ExtendedExplode ( $str, $separators ){
foreach ($separators as $value){
$str= replaceString($value, chr(3), $str);
}
return explode(chr(3), $str);
}
----
Server IP: 195.222.164.18
Probable Submitter: 83.167.112.159
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit -- https://master.php.net/note/edit/70634
Del: integrated -- https://master.php.net/note/delete/70634/integrated
Del: useless -- https://master.php.net/note/delete/70634/useless
Del: bad code -- https://master.php.net/note/delete/70634/bad+code
Del: spam -- https://master.php.net/note/delete/70634/spam
Del: non-english -- https://master.php.net/note/delete/70634/non-english
Del: in docs -- https://master.php.net/note/delete/70634/in+docs
Del: other reasons-- https://master.php.net/note/delete/70634
Reject -- https://master.php.net/note/reject/70634
Search -- https://master.php.net/manage/user-notes.php