Doc #80975 [PATCH]: Doc incomplete - explode

From: Date: Thu, 29 Apr 2021 14:48:22 +0000
Subject: Doc #80975 [PATCH]: Doc incomplete - explode
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18741@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80975&edit=1

 ID:                 80975
 Patch added by:     hallberg.kim@gmail.com
 Reported by:        jon at buymydreamhotel dot com
 Summary:            Doc incomplete - explode
 Status:             Open
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   Ubuntu
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2021-04-22 09:23:31] 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.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80975&edit=1


Thread (3 messages)

« previous php.doc.bugs (#18741) next »