[PHP-DEV] General behaviour of array changing funcs From: Alexander Wirtz (wirtz <email protected>)
Date: 07/17/01

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 <email protected>                |
| web <email protected> GmbH            | WWW:   http://www.web-active.com           |

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>