sort two diamensional array php code example
Example: sort two diamensional array php
<?php
$data=[
['name'=>'Tamil',"distance"=>44],
['name'=>'Tamil',"distance"=>4],
['name'=>'Tamil',"distance"=>14],
['name'=>'Tamil',"distance"=>24],
['name'=>'Tamil',"distance"=>10]
];
for($i=0;$i<count($data);$i++)
{
for($j=$i;$j<count($data);$j++)
{
if($data[$i]['distance']>$data[$j]['distance'])
{
$temp=$data[$i];
$data[$i]=$data[$j];
$data[$j]=$temp;
}
}
}
print_r($data);
#tamilarasan nallairsun