3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EventDispatcher{function r($e, ListenerInterface $l){$this->e[$e][] = $l;} function d($e){foreach ($this->e[$e] as $l){$l->o();}}} class 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.3.0 - 5.3.28, 5.4.0 - 5.4.27
Fatal error: Non-abstract method ListenerInterface::o() must contain body in /in/npUX8 on line 4
Process exited with code 255.

preferences:
181.88 ms | 1395 KiB | 64 Q