3v4l.org

run code in 300+ PHP versions simultaneously
<?php $customer['address'] = '123 fake st'; $customer['name'] = 'Tim'; $customer['dob'] = '12/08/1986'; $customer['dontSortMe'] = 'this value doesnt need to be sorted'; $order = array('name', 'dob', 'address'); $keys= array_flip($order); uksort($customer, function($a, $b)use($keys){ return $keys[$a] - $keys[$b]; }); print_r($customer);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "dontSortMe" in /in/Q4osh on line 12 Warning: Undefined array key "dontSortMe" in /in/Q4osh on line 12 Warning: Undefined array key "dontSortMe" in /in/Q4osh on line 12 Array ( [name] => Tim [dontSortMe] => this value doesnt need to be sorted [dob] => 12/08/1986 [address] => 123 fake st )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
29.2 ms | 406 KiB | 5 Q