#41469 [Opn->Bgs]: err number key in array_slice
ID: 41469
Updated by: scottmac@php.net
Reported By: fallseir at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: linux
PHP Version: 5.2.2
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
array_slice resets numeric keys as it states in the manual, the fourth
parameter can be used to preserve keys.
Previous Comments:
------------------------------------------------------------------------
[2007-05-23 08:55:29] fallseir at gmail dot com
Description:
------------
在数字和字母混合的键值数组中
数字key被重新排列了
use array_slice
array keys for number and string
the result is err!
Reproduce code:
---------------
$thisArray=array(1=>0,2=>31,"a9"=>1,"0"=>3,"abc"=>20);
print_r($thisArray);
$a2=array_slice($thisArray,0,100);
print_r($a2);
Expected result:
----------------
Array
(
[1] => 0
[2] => 31
[a9] => 1
[0] => 3
[abc] => 20
)
Array
(
[1] => 0
[2] => 31
[a9] => 1
[0] => 3
[abc] => 20
)
Actual result:
--------------
Array
(
[1] => 0
[2] => 31
[a9] => 1
[0] => 3
[abc] => 20
)
Array
(
[0] => 0
[1] => 31
[a9] => 1
[2] => 3
[abc] => 20
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41469&edit=1
Thread (2 messages)