Doc #73205 [Ver->Csd]: Default value for $length is shown as 0, but it it not

From: Date: Tue, 04 Oct 2016 10:02:49 +0000
Subject: Doc #73205 [Ver->Csd]: Default value for $length is shown as 0, but it it not
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13986@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73205&edit=1 ID: 73205 Updated by: cmb@php.net Reported by: nick at nickduffell dot com dot au Summary: Default value for $length is shown as 0, but it it not -Status: Verified +Status: Closed Type: Documentation Problem Package: Arrays related PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2016-10-04 10:02:19] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=340300 Log: Fix #73205: Default value for $length is shown as 0, but it it not ------------------------------------------------------------------------ [2016-10-04 09:53:10] cmb@php.net > If length is specified and is zero, no elements will be removed You're right. Actually, the default value is count($input)[1]. It's definitely not NULL, though, see <https://3v4l.org/6AAFC>. [1] <https://github.com/php/php-src/blob/PHP-7.0.11/ext/standard/array.c#L2867-L2871> ------------------------------------------------------------------------ [2016-10-04 09:36:39] nick at nickduffell dot com dot au The document also states the following: If length is specified and is zero, no elements will be removed If zero was the default value the function would do nothing unless you passed a value into that parameter. When I look in my IDE however it has the following, which I believe is correct: function array_splice (array &$input, $offset, $length = null, $replacement = null) {} ------------------------------------------------------------------------ [2016-09-30 08:16:19] cmb@php.net No, 0 is the default value, i.e. without passing a $length, the function behaves as if 0 was passed. ------------------------------------------------------------------------ [2016-09-30 01:15:31] nick at nickduffell dot com dot au Description: ------------ --- From manual page: http://www.php.net/function.array-splice --- Default value for $length is shown as 0, but it should be null. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73205&edit=1

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