php.net |  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.
Password:
Status:
Package:
Bug Type:
Summary:
From: jon at buymydreamhotel dot com
New email:
PHP Version: OS:

 

 [2021-04-22 09:23 UTC] jon at buymydreamhotel dot com
Description:
------------
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.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split

"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.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

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:  https://github.com/php/doc-en/pull/558
Patch:      https://github.com/php/doc-en/pull/558.patch
 [2021-04-29 16:03 UTC] git@php.net
Automatic comment on behalf of thinkverse (author) and web-flow (committer)
Revision: https://github.com/php/doc-en/commit/6b5de328b9dfb7aa391817b5cef123c80acd9979
Log: Fix #80975: Doc incomplete - explode
 [2021-04-29 16:03 UTC] git@php.net
-Status: Open +Status: Closed
 [2021-04-29 17:39 UTC] git@php.net
Automatic comment on behalf of mumumu
Revision: https://github.com/php/doc-ja/commit/90f78e1c5b98b1745c02c0bf14f3934856fc8c78
Log: Fix #80975: Doc incomplete - explode
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 17:01:30 2024 UTC