3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $deps = [ ['for' => '$T3', 'deps' => ['$T2'] ], ['for' => '$T1', 'deps' => [] ], ['for' => '$T2', 'deps' => ['$T1'] ] ]; uasort($deps, function($a, $b){ return in_array($a['for'], $b['deps']) ? -1 : 1; }); print_r($deps);
based on 0LHsQ
Output for 7.0.0 - 7.2.0
Array ( [1] => Array ( [for] => $T1 [deps] => Array ( ) ) [2] => Array ( [for] => $T2 [deps] => Array ( [0] => $T1 ) ) [0] => Array ( [for] => $T3 [deps] => Array ( [0] => $T2 ) ) )
Output for 5.4.10 - 5.6.28
Array ( [0] => Array ( [for] => $T3 [deps] => Array ( [0] => $T2 ) ) [1] => Array ( [for] => $T1 [deps] => Array ( ) ) [2] => Array ( [for] => $T2 [deps] => Array ( [0] => $T1 ) ) )
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/KClbo on line 3
Process exited with code 255.