Req #67659 [NEW]: Use array of delimiters in explode()
| From: | arcadius at mail dot ru | Date: | Mon, 21 Jul 2014 12:07:25 +0000 |
| Subject: | Req #67659 [NEW]: Use array of delimiters in explode() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186761@lists.php.net to get a copy of this message | ||
From: arcadius at mail dot ru
Operating system:
PHP version: Irrelevant
Package: Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:Use array of delimiters in explode()
Description:
------------
Let give several delimiters as array to explode() function to explode
input string by any of them. Delimiters listed earlier have higher
priority:
array(',', ', ') // Wrong!
array(', ', ',') // Right.
Test script:
---------------
<?php
function dump_path($path)
{
$arr = explode( array('\\', '/'), $path );
var_dump($arr);
}
dump_path('d:\\aaa\\bbb.txt');
dump_path('/etc/hosts');
function dump_name($name)
{
$arr = explode( array(' ', '.'), $name );
var_dump($arr);
}
dump_name('Albert Einstein');
dump_name('A.Einstein');
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=67659&edit=1
--