|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 09:01:27 2024 UTC