- Output for 7.0.0 - 7.0.19, 7.1.0 - 7.1.5
- Parse error: syntax error, unexpected ';' in /in/AVjXY on line 2
Process exited with code 255.
<?php
function event($n, $h = null) { static $e = []; return $h ? $e[$n][] = $h : (isset($e[$n] ? array_walk($e[$n], function($e) {$e();}) : 0); }
event('hello', function () { echo 'hello!'; });
echo event('hello') ? 'true!' : 'false!';
echo event('world') ? 'true!' : 'false!';