Find knowledge base article(s) by searching for keywords in the title e.g. type linux in the search box below
Find knowledge base article(s) by browsing the subject categories of articles
Technology quick references, cheatsheets, user manuals etc.
Shop Online through ShopifyLite
Tutorials on various IT applications.
Search Title    (UL:0 |SS:f)

Web >> Development >> PHP >> How to sort an array

asort($array) - sorts an array while maintaining the index association. This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. Returns TRUE on success or FALSE on failure. Example 1. asort() example <?php $fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple"); asort($fruits); reset($fruits); while (list($key, $val) = each($fruits)) { echo "$key = $val\n"; } ?> This example would display: c = apple b = banana d = lemon a = orange
[ © 2008-2021 myfaqbase.com - A property of WPDC Consulting ]