Syntax :
void asort()
Parameters : This function takes no parameters.
Returned value : This function does not return any value.The following programs illustrate the above function:
Program 1 :
// PHP illustration program
// asort() function
$arr
=
array
( "a"
= >
"engineer"
,
"b"
= >
"are" ,
"c"
= >
"awesome"
);
$arrObject
=
new
ArrayObject (
$arr
);
// Sort ArrayObject
$arrObject
-> asort();
print_r (
$arrObject
);
?>
Exit:ArrayObject Object ( [storage: ArrayObject: private] = > Array ([b] = > are = > awesome [a] = > engineer))
Program 2 :
// PHP illustration program
// asort() function
$arr
=
array
(
"a"
= >
"welcome"
,
" b "
= >
" to "
,
"c"
= >
"gfg"
);
$arrObject
=
new
ArrayObject (
$arr
);
// Sort ArrayObject
$arrObject
-> asort();
print_r (
$arrObject
);
?>
Exit:ArrayObject Object ( [storage: ArrayObject: private] = > Array (= > gfg [b] = > to [a] = > welcome))
Link : http://php.net/manual/en/arrayobject.asort.php