Edit report at https://bugs.php.net/bug.php?id=62903&edit=1
ID: 62903 Updated by: ahar...@php.net Reported by: php at nobswolf dot info Summary: array_slice ignores preserve_keys with no length -Status: Open +Status: Not a bug Type: Bug Package: Arrays related Operating System: windows PHP Version: 5.3.16 Block user comment: N Private report: N New Comment: Not a bug, per the first comment. Previous Comments: ------------------------------------------------------------------------ [2012-08-23 06:53:32] reeze dot xia at gmail dot com I don't get it. could you please supply full test script. Look at this. perserver_keys works. http://3v4l.org/hCVAv#v524 and #4168 was marked at fixed. Do I missing something? ------------------------------------------------------------------------ [2012-08-23 06:52:26] php at nobswolf dot info no its not... the problem is a later array_merge, which does not have the option of preserve_keys my fault, sorry maybe every "reorder"-function should have this option ------------------------------------------------------------------------ [2012-08-23 06:18:54] php at nobswolf dot info Description: ------------ I want to slice an array into a first one with the first 3 entries and a second one with the rest (variable length). Test script: --------------- $wertA2 = array_slice ($wertA, 0, 3, true); $wertA3 = array_slice ($wertA, 3, null, true); Expected result: ---------------- I need preserved keys even when I can not give a length. Actual result: -------------- The preserve_keys = true gets ignored and keys a get renumbered :-( see also #41686 This bug is 5 years old. When will it get fixed? ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62903&edit=1