note 58985 deleted from language.types.array by mazzanet

From: Date: Wed, 23 Nov 2005 09:23:26 +0000
Subject: note 58985 deleted from language.types.array by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-98967@lists.php.net to get a copy of this message
Note Submitter: wbeckler+php dot net at gmail dot com ---- This is in response to comment on pop by Joe Morrison <jdm at powerframe dot com> (08-Nov-2004 01:26). Unlike perl, arrays remain in order no matter what the key is. This is the case whether the key is a number or a string. When you pop, the last element is the last element in the array's order, not the highest keyed item. I think what you really want is to sort your array by the keys. That is easily done with the ksort() function. After you do that, pop will behave on integer-keyed arrays just as you would expect.

« previous php.notes (#98967) next »