3v4l.org

run code in 300+ PHP versions simultaneously
<?php function e($n,$p,$c=0){static $a;@krsort($a[$n]);if($c)$a[$n][$p][]=$c;else foreach($a[$n] as$q)foreach($q as$r)$r($p);} function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);} ob_start(); e( 'event', 0, function ($data) { echo "event, $data, priority 0;"; } ); e( 'event', 10, function ($data) { echo "event, $data, priority 10;"; } ); e( 'other_event', -5, function ($data) { echo "other_event, $data, priority -5;"; } ); e( 'other_event', 5, function ($data) { echo "other_event, $data priority 5;"; } ); e('event', 'dataX'); e('other_event', 'dataY'); $output = ob_get_contents(); ob_end_clean(); it( 'calls event listeners in the right order', $output === 'event, dataX, priority 10;event, dataX, priority 0;other_event, dataY priority 5;other_event, dataY, priority -5;' );
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: krsort(): Argument #1 ($array) must be of type array, null given in /in/nSQJH:1 Stack trace: #0 /in/nSQJH(1): krsort(NULL) #1 /in/nSQJH(6): e('event', 0, Object(Closure)) #2 {main} thrown in /in/nSQJH on line 1
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:
36.97 ms | 401 KiB | 8 Q