|  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: halloanjedendenichkenne at gmail dot com
New email:
PHP Version: OS:


 [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-2022 The PHP Group
All rights reserved.
Last updated: Sat Aug 13 20:05:45 2022 UTC