PHP 5 Sorting Arrays

<?php $cars = array("Volvo", "BMW", "Toyota"); sort($cars); ?> <?php $numbers = array(4, 6, 2, 22, 11); sort($numbers); ?> <?php $numbers = array(4, 6, 2, 22, 11); rsort($numbers); ?> <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); asort($age); ?> <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); ksort($age); ?> <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); arsort($age); ?> <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); krsort($age); ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.