Suppose I have an array such as the following
$data[0] = array(1, c,);
$data[1] = array(3, b);
$data[2] = array(2, a);

I want to be able to sort $data array by the second dimension so that it would end up looking like this

$data[0] = array(2, a);
$data[1] = array(3, b);
$data[2] = array(1, c);

    One way:

    usort(
       $data,
       create_function(
          '$a,$b',
          'return strcmp($a[1], $b[1]);'
       )
    );
    
      Write a Reply...