tags:

views:

80

answers:

4

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.......

+3  A: 

You can do sort($a).

This first Google result for "sort array php" is this:

http://php.net/manual/en/function.sort.php

David Y. Ross
+1 for the lesson in Google
Lauri Lehtinen
sort() do not sort multidimensional arrays. Go figure
Col. Shrapnel
A: 
  1. Why your array is multidimensional?
  2. Join your nested arrays into one, sort it, and then you can output that sorted array in a manner you wish
Col. Shrapnel
+2  A: 

You can use array_multisort, specially if your inner arrays has same size. I have checcked it, hope it will serve as you need.

Sadat
A: 

Try this:

$resort = "return (1*strnatcmp(\$x['0'], \$y['0']));";
uasort($a, create_function('$x,$y', $resort));
print_r($a);
turbod