3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [ "Alfa" => ["Temp", "Zeta"], "Teta" => ["Zeta", "Temp"], "Zeta" => ["Temp"], "Temp" => [], ]; asort($array); uasort ($array, function ($a, $b) { return in_array(key($a), $b); }); print_r($array);
based on o7UrT
Output for 7.0.0 - 7.3.0rc4
Array ( [Temp] => Array ( ) [Teta] => Array ( [0] => Zeta [1] => Temp ) [Alfa] => Array ( [0] => Temp [1] => Zeta ) [Zeta] => Array ( [0] => Temp ) )
Output for 5.6.0 - 5.6.24
Array ( [Temp] => Array ( ) [Zeta] => Array ( [0] => Temp ) [Alfa] => Array ( [0] => Temp [1] => Zeta ) [Teta] => Array ( [0] => Zeta [1] => Temp ) )