samedi 25 avril 2015

array_multisort not working PHP


Please i need your help. I want to sort the array into an ascending order by priority time.

Heres is the array

Array
(
    [process] => Array
        (
            [0] => Array
                (
                    [name] => p1
                    [burst_time] => 2
                    [priority_time] => 3
                )

            [1] => Array
                (
                    [name] => p2
                    [burst_time] => 2
                    [priority_time] => 4
                )

            [2] => Array
                (
                    [name] => p3
                    [burst_time] => 2
                    [priority_time] => 1
                )

        )

)

I tried this code but doesn't work for me. Thank you in advanced :)

foreach ($data as $key => $row) {
    $mid[$key]  = $row;
}
array_multisort($mid, SORT_ASC, $data);


Aucun commentaire:

Enregistrer un commentaire