我有一个简单的关联数组.
<?PHP $assocArray = array('a' => 1,'b' => 2,'c' => 3); ?>
仅使用while循环,如何在此结果中打印?
$a = 1 $b = 2 $c = 3
<?PHP $assocArray = array('a' => 1,'c' => 3); $keys = array_keys($assocArray); rsort($keys); while (!empty($keys)) { $key = array_pop($keys); echo $key . ' = ' . $assocArray[$key] . '<br />'; }; ?>
谢谢.