ArrayObject asort() Function in PHP Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The asort() function of the ArrayObject class in PHP is used to sort all of the entries of the ArrayObject according to the values. The elements are arranged according to the values keeping the maintaining the association of the keys with the value. Syntax: void asort() Parameters: This function does not accepts any parameters. Return Value: This function does not returns any value. Below programs illustrate the above function: Program 1: php <?php // PHP program to illustrate the // asort() function $arr = array("a" => "geeks", "b" => "are", "c" => "awesome"); $arrObject = new ArrayObject($arr); // Sort the ArrayObject $arrObject->asort(); print_r($arrObject); ?> Output: ArrayObject Object ( [storage:ArrayObject:private] => Array ( [b] => are [c][/c] => awesome [a] => geeks ) ) Program 2: php <?php // PHP program to illustrate the // asort() function $arr = array("a" => "welcome", "b" => "to", "c" => "gfg"); $arrObject = new ArrayObject($arr); // Sort the ArrayObject $arrObject->asort(); print_r($arrObject); ?> Output: ArrayObject Object ( [storage:ArrayObject:private] => Array ( [c][/c] => gfg [b] => to [a] => welcome ) ) Reference: https://www.php.net/manual/en/arrayobject.asort.php Comment More infoAdvertise with us Next Article ArrayObject uasort() Function in PHP G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-array PHP-function PHP-ArrayObject +1 More Similar Reads ArrayObject ksort() Function in PHP The ksort() function of the ArrayObject class in PHP is used to sort the elements of the ArrayObject according to the keys. This function does not affects the association of the keys with the values, it just sorts the entries of the ArrayObject according to the Keys. Syntax: void ksort() Parameters: 2 min read ArrayObject ksort() Function in PHP The ksort() function of the ArrayObject class in PHP is used to sort the elements of the ArrayObject according to the keys. This function does not affects the association of the keys with the values, it just sorts the entries of the ArrayObject according to the Keys. Syntax: void ksort() Parameters: 2 min read ArrayObject ksort() Function in PHP The ksort() function of the ArrayObject class in PHP is used to sort the elements of the ArrayObject according to the keys. This function does not affects the association of the keys with the values, it just sorts the entries of the ArrayObject according to the Keys. Syntax: void ksort() Parameters: 2 min read ArrayObject uasort() Function in PHP The uasort() function of the ArrayObject class in PHP is used to sort values of an ArrayObject according to a user defined comparison function. The function compares and arranges the values present in the ArrayObject according to the given comparison function. This method does not affects the key-va 2 min read ArrayObject uasort() Function in PHP The uasort() function of the ArrayObject class in PHP is used to sort values of an ArrayObject according to a user defined comparison function. The function compares and arranges the values present in the ArrayObject according to the given comparison function. This method does not affects the key-va 2 min read ArrayObject uasort() Function in PHP The uasort() function of the ArrayObject class in PHP is used to sort values of an ArrayObject according to a user defined comparison function. The function compares and arranges the values present in the ArrayObject according to the given comparison function. This method does not affects the key-va 2 min read Like