I have an array($myArray)
Array ( [0] =>
Array ( [0] => new
[1] => NFL930
[2] => Ohio
...
)
[1] =>
Array ( [0] => new
[1] => MLB382
[2] => Florida
...
)
[2] =>
Array ( [0] => new
[1] => MLB101
[2] => Vermont
...
)
[3] =>
Array ( [0] => new
[1] => NFL732
[2] => Alabama
...
)
[4] =>
Array ( [0] => old
[1] => MLB490
[2] => Texas
...
)
[5] =>
Array ( [0] => old
[1] => MLB821
[2] => Atlanta
...
)
[6] =>
Array ( [0] => old
[1] => NFL293
[2] => Maine
...
)
.....
)
I have a function that sorts the [0] index which is displayed above so all the "new" entries are first, then all of the "old" entries are listed.
usort($myArray, function($a, $b) use ($myValues){
return $myValues[$a[0]] - $myValues[$b[0]];
});
The array $myValues looks like
Array ( [New] => 0 [Old] => 1 [Other] => 2 )
I want to keep the [0] index sorting as is display all arrays with new first, then display array with old, etc etc. Then i want to display the ones with "NFL" before the ones with MLB. For example the desired output will be
Array ( [0] =>
Array ( [0] => new
[1] => NFL930
[2] => Ohio
...
)
[1] =>
Array ( [0] => new
[1] => NFL732
[2] => Alabama
...
)
[2] =>
Array ( [0] => new
[1] => MLB101
[2] => Vermont
...
)
[3] =>
Array ( [0] => new
[1] => MLB382
[2] => Florida
...
)
[4] =>
Array ( [0] => old
[1] => NFL293
[2] => Maine
...
)
[5] =>
Array ( [0] => old
[1] => MLB821
[2] => Atlanta
...
)
[6] =>
Array ( [0] => old
[1] => MLB490
[2] => Texas
...
)
.....
)