|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #52268 explode with an Array as Delimiter
Submitted: 2010-07-06 20:28 UTC Modified: 2010-12-01 15:34 UTC
From: halloanjedendenichkenne at gmail dot com Assigned:
Status: Wont fix Package: Arrays related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
23 - 6 = ?
Subscribe to this entry?

 [2010-07-06 20:28 UTC] halloanjedendenichkenne at gmail dot com
It would be useful if you were able to pass an Array as Delimiter to explode.
The "Test Script" contains an Example.

Test script:

  var_dump(explode(array(',', '.', '!', ' '), 'Hello, World! This is a Test!'));

    Should output something like:
      array(8) {
        string(5) "Hello"
        string(0) ""
        string(5) "World"
        string(0) ""
        string(4) "This"
        string(2) "is"
        string(1) "a"
        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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-11 01:17 UTC] jinmoku at hotmail dot com
use preg_split instead ;)

var_dump(preg_split('/[, !\.]/', 'Hello, World! This is a Test!'));
 [2010-12-01 15:34 UTC]
-Status: Open +Status: Wont fix -Package: Unknown/Other Function +Package: Arrays related
 [2010-12-01 15:34 UTC]
See above.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 16:01:31 2024 UTC