note 70634 deleted from function.explode by tularis
| From: | tularis@php.net | Date: | Mon, 23 Oct 2006 08:35:31 +0000 |
| Subject: | note 70634 deleted from function.explode by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118990@lists.php.net to get a copy of this message | ||
Note Submitter: bait at clabs dot ru
Reason: bad code
----
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);
}