3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Parent extends Observer { function createChild() { $this->callme(); // this is OK return new Child (function() { $this->callme(); }); } } class Child { private $gatewayFunction; public function __constructor (Closure $gatewayFunction) { $this->gatewayFunction = $gatewayFunction; } public function __destroy() { $this->gatewayFunction->__invoke(); } }
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.29, 5.6.8 - 5.6.13
Fatal error: Cannot use 'Parent' as class name as it is reserved in /in/n9Lcs on line 4
Process exited with code 255.

preferences:
186.1 ms | 1395 KiB | 62 Q