Req #52268 [Opn->Wfx]: explode with an Array as Delimiter
| From: | jani@php.net | Date: | Wed, 01 Dec 2010 14:34:37 +0000 |
| Subject: | Req #52268 [Opn->Wfx]: explode with an Array as Delimiter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156628@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52268&edit=1
ID: 52268
Updated by: jani@php.net
Reported by: halloanjedendenichkenne at gmail dot com
Summary: explode with an Array as Delimiter
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
-Package: Unknown/Other Function
+Package: Arrays related
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
See above.
Previous Comments:
------------------------------------------------------------------------
[2010-07-11 01:17:18] jinmoku at hotmail dot com
use preg_split instead ;)
var_dump(preg_split('/[, !\.]/', 'Hello, World! This is a Test!'));
------------------------------------------------------------------------
[2010-07-06 20:28:38] halloanjedendenichkenne at gmail dot com
Description:
------------
It would be useful if you were able to pass an Array as Delimiter to
explode.
The "Test Script" contains an Example.
Test script:
---------------
<?php
var_dump(explode(array(',', '.', '!', ' '), 'Hello,
World! This is a
Test!'));
/*
Should output something like:
array(8) {
[0]=>
string(5) "Hello"
[1]=>
string(0) ""
[2]=>
string(5) "World"
[3]=>
string(0) ""
[4]=>
string(4) "This"
[5]=>
string(2) "is"
[6]=>
string(1) "a"
[7]=>
string(4) "Test"
}
*/
?>
Expected result:
----------------
Included in the Test Script
Actual result:
--------------
Warning: explode() expects parameter 1 to be string, array given in php
shell code
on line 1
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52268&edit=1