sort an associative array on the basis of keys
<?php
$nameandage = array (
D => 24,
A => 44,
C => 34,
E => 55,
B => 21,
F => 48);
ksort ($nameandage);
foreach ($nameandage as $keys => $val) {
echo "$keys = $val", "\n";
}
?>
Related examples in the same category