Created
May 21, 2020 06:12
-
-
Save phpfiddle/40c1d529e1e60db404aab0eecf58bb3c to your computer and use it in GitHub Desktop.
[ Posted by Abdul Rehman ] this is assognment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//simple array | |
$fruits=["orange","apple","grapes","banana",12,65,45]; | |
echo " before Sorting <pre>"; | |
print_r ($fruits); | |
echo "</pre>"; | |
sort($fruits); | |
echo " after Sorting <pre>"; | |
print_r ($fruits); | |
echo "</pre>"; | |
//associative array | |
$as_fruits=[ | |
'apple'=>['dd','gn','qw','vc'], | |
'grapes'=>['sdf','ffa','item','sce'], | |
'orange'=>['gg','ad','bn','cf'] | |
]; | |
echo " before Sorting <pre>"; | |
print_r ($as_fruits); | |
echo "</pre>"; | |
//sort by key | |
asort($as_fruits); | |
echo " after Sorting <pre>"; | |
print_r ($as_fruits); | |
echo "</pre>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment