asort
- asort
<?php
$a = array('two' => 2, 'one' => 1, 'three' => 3);
asort($a); # sort according to values
while (list($key, $value) = each($a)) {
print "$key $value\n";
}
?>
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
<?php
$a = array('two' => 2, 'one' => 1, 'three' => 3);
asort($a); # sort according to values
while (list($key, $value) = each($a)) {
print "$key $value\n";
}
?>