I have a mutidimensional array something like this
<?php
$data2[3][1]=6;
$data2[9][3]=4;
$data2[9][2]=18;
$data2[4][2]=24;
$data2[4][0]=12;
$data2[4][1]=14;
?>
I want to sort this array by its key, so that it looks like this
$data2[3][1]=6;
$data2[4][0]=12;
$data2[4][1]=14;
$data2[4][2]=24;
$data2[9][2]=18;
$data2[9][3]=4;
used this
foreach ($data2 as $k[]){
ksort($k);
}
print_r($k);
but not working.