3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Signal() { private $listeners; function add($callback) { $this->listeners[]=$callback; } function dispatch() { if (empty($this->listeners)) { return; } foreach ($this->listeners as $callback) { call_user_func_array($callback, func_get_args()); } } } function myListener() { print_r(func_get_args()); } $signal = new Signal(); $signal->add('myListener'); $signal->add('myListener'); $signal->add('myListener'); $signal->dispatch('a',456,array(123));
Output for 5.3.0 - 5.4.27
Parse error: syntax error, unexpected '(', expecting '{' in /in/mmPmr on line 3
Process exited with code 255.