Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to loop with while in php for array associative

$assocarray = array('a' => 1, 'b' => 2, 'c' => 3);
$keys = array_keys($assocarray);
rsort($keys);
while (!empty($keys)) {
    $key = array_pop($keys);
    echo $key . ' = ' . $assocarray[$key] . '<br />';
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #loop #php #array #associative
ADD COMMENT
Topic
Name
6+9 =