I'd like to use uasort to sort a multidimensional array. The array looks like this:
Array
(
    [0] => Array
        (
            [0] => 1612134001
            [1] => 1
            [2] => 'a'
        )
    [1] => Array
        (
            [0] => 1612134000
            [1] => 1
            [2] => 'b'
        )
    [2] => Array
        (
            [0] => 1612171201
            [1] => 0
            [] => 'c'
        )
    [3] => Array
        (
            [0] => 1612171200
            [1] => 0
            [] => 'd'
        )
    [4] => Array
        (
            [0] => 1612220400
            [1] => 1
            [2] => 'e'
        )
)
I expected output should look like this (sort timestamp asc [0] but if [1] is 0 put it above, but still consider the timestamp):
Array
(
    [0] => Array
        (
            [0] => 1612171200
            [1] => 0
            [] => 'd'
        )
    [0] => Array
        (
            [0] => 1612171201
            [1] => 0
            [] => 'c'
        )
    [1] => Array
        (
            [0] => 1612134000
            [1] => 1
            [2] => 'b'
        )
    [2] => Array
        (
            [0] => 1612134001
            [1] => 1
            [2] => 'a'
        )
    [3] => Array
        (
            [0] => 1612220400
            [1] => 1
            [2] => 'e'
        )
)
I tried uasort but they overwrite each other. Is it possible to do it in one uasort? I couldn't find anything about it.
  uasort($array, function ($a, $b) {
    return $a[0] - $b[0];
  });
  
  uasort($array, function ($a, $b) {
    return $a[1] - $b[1];
  });
 
     
    