|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80975 Doc incomplete - explode
Submitted: 2021-04-22 09:23 UTC Modified: -
From: jon at buymydreamhotel dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Ubuntu
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: jon at buymydreamhotel dot com
New email:
PHP Version: OS:


 [2021-04-22 09:23 UTC] jon at buymydreamhotel dot com
The documentation for explode() is incomplete,it does not define the behaviour when separator is found at the start or end of the string to be split. Compare doc for similar JS function here.

"If separator appears at the beginning (or end) of the string, it still has the effect of splitting.  The result is an empty (i.e. zero length) string, which appears at the first (or last) position of the returned array."

The behaviour reported above for the JS equivalent appears to be correct for the PHP explode() function, at least in my code for a '/' at the end of a URL. 

I think the common use of '/' at the end of URLs makes a case for making sure this is precisely documented.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-29 14:48 UTC] hallberg dot kim at gmail dot com
The following pull request has been associated:

Patch Name: [80975] Fix: Doc incomplete - explode
On GitHub:
 [2021-04-29 16:03 UTC]
Automatic comment on behalf of thinkverse (author) and web-flow (committer)
Log: Fix #80975: Doc incomplete - explode
 [2021-04-29 16:03 UTC]
-Status: Open +Status: Closed
 [2021-04-29 17:39 UTC]
Automatic comment on behalf of mumumu
Log: Fix #80975: Doc incomplete - explode
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Oct 05 03:04:12 2022 UTC