3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data[] = array('title' => 'hello', 'attributes' => array('id' => 4, 'startdate' => '2013-06-11')); $data[] = array('title' => 'hello second entry', 'attributes' => array('id' => 6, 'startdate' => '2013-04-11')); print "Inital Data\n"; print_r($data); print "\n"; usort($array, function($a, $b) { if ($a['attributes']['startdate'] > $b['attributes']['startdate']) return 1; if ($a['attributes']['startdate'] < $b['attributes']['startdate']) return -1; return 0; }); print "Sorted Data\n"; print_r($data); print "\n";
Output for git.master, git.master_jit, rfc.property-hooks
Inital Data Array ( [0] => Array ( [title] => hello [attributes] => Array ( [id] => 4 [startdate] => 2013-06-11 ) ) [1] => Array ( [title] => hello second entry [attributes] => Array ( [id] => 6 [startdate] => 2013-04-11 ) ) ) Fatal error: Uncaught TypeError: usort(): Argument #1 ($array) must be of type array, null given in /in/fPbfL:11 Stack trace: #0 /in/fPbfL(11): usort(NULL, Object(Closure)) #1 {main} thrown in /in/fPbfL on line 11
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.25 ms | 402 KiB | 8 Q