Sorting With Asort()

<?php
$meal = array('breakfast' => 'A',
              'lunch' => 'B',
              'snack' => 'C',
              'dinner' => 'D');print "Before Sorting:\n";
foreach ($meal as $key => $value) {
    print "   \$meal: $key $value\n";
}asort($meal);print "After Sorting:\n";
foreach ($meal as $key => $value) {
    print "   \$meal: $key $value\n";
}
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.