Re: array_pop() with key-value pair ???

From: Date: Fri, 16 Feb 2007 14:07:51 +0000
Subject: Re: array_pop() with key-value pair ???
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-248959@lists.php.net to get a copy of this message
Mikey wrote:
I guess you have tried foreach? foreach ($array as $key => $value) {
    ...
}
No.. loop should not be necessary when you want to take only the first or the last element in the array. Better using array_pop() array_shift() reset() end() and each() functions for better run times.

« previous php.general (#248959) next »