3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $rules= array('trim', 'max_lenght[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);