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

From: Date: Tue, 04 Oct 2016 09:53:11 +0000
Subject: Doc #73205 [Nab->Ver]: 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-13985@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 should be null. +Summary: Default value for $length is shown as 0, but it it not -Status: Not a bug +Status: Verified Type: Documentation Problem Package: Arrays related PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: > 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> Previous Comments: ------------------------------------------------------------------------ [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 (#13985) next »