3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $customer['address'] = '123 fake st'; $customer['name'] = 'Tim'; $customer['dob'] = '12/08/1986'; $customer['dontSortMe'] = 'this value doesnt need to be sorted'; $properOrderedArray = array_merge(array_flip(array('name', 'dob', 'address')), $customer); var_dump($properOrderedArray);
Output for 4.3.0 - 7.1.0
array(4) { ["name"]=> string(3) "Tim" ["dob"]=> string(10) "12/08/1986" ["address"]=> string(11) "123 fake st" ["dontSortMe"]=> string(35) "this value doesnt need to be sorted" }