PHP usort( ) functionThe PHP usort( ) function is used to sort an array by its value using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. This function was introduced in PHP 4.0. SyntaxParameter
Return typeThe usort( ) function returns true on success and false on failure. Example 1Output: Array ( [0] => denmark [1] => bangladesh [2] => australia ) Example 2Output: Array ( [0] => 8 [1] => 11 [2] => 56 [3] => 96 ) Example 3Output: Array ( [0] => c++ [1] => csharp [2] => java [3] => php ) Example 4Output: Array ( [0] => aajtak [1] => abp [2] => ndtv [3] => zee news )
Next TopicPHP Array Functions
|