3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $rules= array('trim', 'max_length[10]', 'callback__test'); $rules[] = 'required'; if($index = array_search('required', $rules)) { $moved_rule = $rules[$index]; unset($rules[$index]); array_unshift($rules, $moved_rule); } if($index = array_search('trim', $rules)) { $moved_rule = $rules[$index]; unset($rules[$index]); array_unshift($rules, $moved_rule); } print_r($rules);
based on MmAim
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
Array ( [0] => trim [1] => required [2] => max_length[10] [3] => callback__test )