getting the "next" element of an associative array
| From: | Olav Mørkrid | Date: | Thu, 12 Jul 2007 05:57:41 +0000 |
| Subject: | getting the "next" element of an associative array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-258666@lists.php.net to get a copy of this message | ||
let's say we have the following associative array:
$array = array(
"red" => "ferrari",
"yellow" => "volkswagen",
"green" => "mercedes",
"blue" => "volvo"
);
then we have a current index into the array:
$index = "yellow";
$current = $array[$index];
now: how do i get the key of the next array element (in this case "green")?
$next = ?