I have some of the data from mysql tables and I am trying to calculate speed on the fly and displaying it on graphs. I would like to display the speed column in descending order, I tried asort and rsort but the function did not work out for me. Here is the code where i am got stuck. I have already calculated the speed and brought it into the array and now need to sort the array in descending order on speed column.
       $myArray[$plate][$inDate] = array($inDateTime, $outDateTime, $inDate, $dur_string,(round($speed,2)));
      // asort($myArray,$speed);--- > this is where i am  stuck.
    }
}
$new_platelist = array_unique($new_platelist);
while ($startLoopDate < $endLoopDate) {
    $dayString = strftime("%a, %d %B %Y", $startLoopDate);
   $dayCheck = strftime("%Y-%m-%d", $startLoopDate);
    print "<h2>$dayString</h2>";
    print "<table width=\"100%\">";
    print " <tr>";
    print " <th>plate</th>";
    print " <th>Entry Time</th>";
    print " <th>Exit Time</th>";
    print " <th>Duration</th>";
    print " <th>Speed MPH</th>";
    print " </tr>";
    foreach($new_platelist as $wlPlate) {
       if (isset($myArray[$wlPlate][$dayCheck])){
           print "<tr>";
           print "<td>$wlPlate</td>";
           if (isset($myArray[$wlPlate][$dayCheck])){
               print "<td>".$myArray[$wlPlate][$dayCheck][0]."</td>";
               print "<td>".$myArray[$wlPlate][$dayCheck][1]."</td>";
               print "<td>".$myArray[$wlPlate][$dayCheck][3]."</td>";
               print "<td>".$myArray[$wlPlate][$dayCheck][4]."</td>";
            }
            else {
                print "<td>Vehicle Not Seen</td>";
                print "<td>Vehicle Not Seen</td>";
                print "<td>Vehicle Not Seen</td>";
            }
        }
    print "</tr>";
    }
    print "</table>";
Array looks like this: Needs sort by array index [4] which is the speed column calculated on fly.
Array
(
    [YX86RYB] => Array
        (
            [2021-09-06] => Array
                (
                    [0] => 2021-09-06 13:55:12
                    [1] => 2021-09-06 13:55:26
                    [2] => 2021-09-06
                    [3] => 14 secs 
                    [4] => 15.66
                )
        )
)
Array
(
    [YX94RYB] => Array
        (
            [2021-09-06] => Array
                (
                    [0] => 2021-09-06 13:55:12
                    [1] => 2021-09-06 13:55:26
                    [2] => 2021-09-06
                    [3] => 14 secs 
                    [4] => 15.66
                )
        )
    [YX11WCY] => Array
        (
            [2021-09-07] => Array
                (
                    [0] => 2021-09-07 09:24:17
                    [1] => 2021-09-07 09:24:32
                    [2] => 2021-09-07
                    [3] => 15 secs 
                    [4] => 14.61
                )
        )
)
 
    