3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class EventDispatcher{function r($e, ListenerInterface $l){$this->e[$e][] = $l;} function d($e){foreach ($this->e[$e] as $l){$l->o();}}} interface ListenerInterface{function o();} class MyListener{function o(echo '*';)} $l = new MyListener(); $e = new EventDispatcher(); $e->r('1', $l); $e->r('1', $l); $e->r('2', $l); $e->d();
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting '&' or variable (T_VARIABLE) in /in/XTXtk on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_ECHO, expecting '&' or T_VARIABLE in /in/XTXtk on line 6
Process exited with code 255.