|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33378 The explode() function doesn't work properly when using "+" as the separator
Submitted: 2005-06-17 05:02 UTC Modified: 2005-06-17 09:49 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: mbrown at dxsonline dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.0.4 OS: *
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: mbrown at dxsonline dot com
New email:
PHP Version: OS:


 [2005-06-17 05:02 UTC] mbrown at dxsonline dot com
The explode() function will not properly separate strings that are separated by plus signs (+). It will put all of the string into the first array element separated by spaces.

Reproduce code:
$toExplode = "1+1+1+1";
$exploded = explode("+", $toExplode);

foreach($exploded as $e) {
echo "Bug: ".$e."<br />"; }

Expected result:
Bug: 1
Bug: 1
Bug: 1
Bug: 1

Actual result:
Bug: 1 1 1 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-17 09:49 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Works like a charne:
$ php -r 'var_dump(explode("+", "1+2+3+4"));'
array(4) {
  string(1) "1"
  string(1) "2"
  string(1) "3"
  string(1) "4"

Since your output does not contain the '+' sign you obviously executed the code through a browser in which case the output is absolutley exected since the '+' are converted to spaces before your script sees them.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Mar 30 13:03:41 2023 UTC