Example :
$a [] = array ('google','bing','yahoo');
$a [] = array ('America','France','Germany');
$a [] = array ('Africa','Asia','Europe');
And I want to sort her in table like that :
Africa....... America........ google.......
You can do sort($a)
.
This first Google result for "sort array php" is this:
You can use array_multisort , specially if your inner arrays has same size. I have checcked it, hope it will serve as you need.
Try this:
$resort = "return (1*strnatcmp(\$x['0'], \$y['0']));";
uasort($a, create_function('$x,$y', $resort));
print_r($a);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.