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
 [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-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 09:03:37 2021 UTC