Req #67659 [Opn]: Support array of delimiters in explode()
| From: | arcadius at mail dot ru | Date: | Mon, 21 Jul 2014 12:10:10 +0000 |
| Subject: | Req #67659 [Opn]: Support array of delimiters in explode() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186762@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67659&edit=1
ID: 67659
User updated by: arcadius at mail dot ru
Reported by: arcadius at mail dot ru
-Summary: Use array of delimiters in explode()
+Summary: Support array of delimiters in explode()
Status: Open
Type: Feature/Change Request
Package: Unknown/Other Function
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Changed title of the request.
Previous Comments:
------------------------------------------------------------------------
[2014-07-21 12:07:24] arcadius at mail dot ru
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 this bug report at https://bugs.php.net/bug.php?id=67659&edit=1