Answers for "how to loop with while in php for array associative"

PHP
0

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 />';
};
Posted by: Guest on December-05-2020

Code answers related to "how to loop with while in php for array associative"

Browse Popular Code Answers by Language