General behaviour of array changing funcs
| From: | (Alexander Wirtz) | Date: | Tue, 17 Jul 2001 13:37:46 +0000 |
| Subject: | General behaviour of array changing funcs | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-60153@lists.php.net to get a copy of this message | ||
Hi everyone,
I encountered a problem today, which seems to be a well known
"feature", but I didn't find _one_ comment of a responsible person
on this by looking into the bug-database!
The snippet
<?php
$bla = array( "5" => "green", "9" => "orange" );
var_dump( $bla );
array_shift( $bla );
var_dump( $bla );
?>
produces
array(2) {
[5]=>
string(5) "green"
[9]=>
string(6) "orange"
}
array(1) {
[0]=>
string(6) "orange"
}
The array_shift changes the integer-keys of the array. Likewise behaviour
with array_pop and array_slice.
Would anyone of the core-coders be so kind and give me a hopefully
reasonable answer to this problem? I'm not very fond of this...
Greetings
Alexander
--
| Alexander Wirtz | eMail: wirtz@web-active.com |
| web@ctive GmbH | WWW: http://www.web-active.com |