I have an array like:
$a = array(array("fghfg12" => 34),
           array("dfgdf23" => 97),
           array("wetw13" => 65),
           array("rtyr567" => 18));
I want to sort this array by its value. That means I want the result like:
$a = array(array("rtyr567" => 18),
           array("fghfg12" => 34),
           array("wetw13" => 65),
           array("dfgdf23" => 97));
For this I am using:
uksort($a , function($key1, $key2) use ($res) {
      return (array_search($key1, $res) > array_search($key2, $res));
  });
Another method:
$arr2ordered = array() ;
foreach (array_keys($a) as $key) {
   $arr2ordered[$key] = $a[$key] ;
}
But I didn't get my result;
I already tried with this also:
$price = array();
    foreach ($a as $key => $row)
    {
        $price[$key] = $row;
    }
    array_multisort($price, SORT_DESC, $a);
    print_r($a);
But still, I didnt get my result
 
     
    