3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(array('date'=>'2014-12-01', 'price'=>'123.00'), array('date'=>'2013-12-01', 'price'=>'123.00'), array('date'=>'2014-02-01', 'price'=>'123.00'), array('date'=>'2014-03-01', 'price'=>'123.00')); var_dump($array); function date_compare($a, $b, $key) { $t1 = strtotime($a[$key]); $t2 = strtotime($b[$key]); return $t1 - $t2; } usort($array, array('date_compare', 'date')); var_dump($array);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> array(2) { ["date"]=> string(10) "2014-12-01" ["price"]=> string(6) "123.00" } [1]=> array(2) { ["date"]=> string(10) "2013-12-01" ["price"]=> string(6) "123.00" } [2]=> array(2) { ["date"]=> string(10) "2014-02-01" ["price"]=> string(6) "123.00" } [3]=> array(2) { ["date"]=> string(10) "2014-03-01" ["price"]=> string(6) "123.00" } } Fatal error: Uncaught TypeError: usort(): Argument #2 ($callback) must be a valid callback, class "date_compare" not found in /in/ZRXQS:12 Stack trace: #0 /in/ZRXQS(12): usort(Array, Array) #1 {main} thrown in /in/ZRXQS on line 12
Process exited with code 255.

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:
51.3 ms | 402 KiB | 8 Q