|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-03-05 03:22 UTC] bjori@php.net
[2008-02-19 00:16 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Mar 24 12:00:01 2026 UTC |
Description: ------------ The optional fourth parameter preserve_keys is only available if the third parameter length is also supplied. If the developer wishes to set preserve_keys to TRUE, he must also supply the length of the array he wishes to have returned, which may not be known. There is no way to indicate that length should remain optional - like passing NULL - while providing a value for preserve_keys. Reproduce code: --------------- $SomeArray = array('First','Middle','Last'); var_dump(array_slice($SomeArray,1,NULL,TRUE)); Expected result: ---------------- array(2) { [1]=> string(6) "Middle" [2]=> string(4) "Last" } Actual result: -------------- array(0) { }