Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created May 21, 2020 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/40c1d529e1e60db404aab0eecf58bb3c to your computer and use it in GitHub Desktop.
Save phpfiddle/40c1d529e1e60db404aab0eecf58bb3c to your computer and use it in GitHub Desktop.
[ Posted by Abdul Rehman ] this is assognment
<?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