Sort the entries by value with ArrayObject::asort in PHP
Description
The following code shows how to sort the entries by value with ArrayObject::asort.
Example
/*from ww w. ja v a 2s . co m*/
<?php
$fruits = array("d" => "4", "a" => "1", "b" => "2", "c" => "3");
$fruitArrayObject = new ArrayObject($fruits);
$fruitArrayObject->asort();
foreach ($fruitArrayObject as $key => $val) {
echo "$key = $val\n";
}
?>
The code above generates the following result.