3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function __invoke() { echo "Invoking A() Class"; } } class B { public $a; public function __construct() { $this->a = new A(); } public function __invoke() { echo "Invoking B() Class"; } } $a = new A(); $b = new B(); $a(); $b(); ($b->a)(); $c = $b->a; $c();
based on kli1O
Output for 7.0.0 - 7.2.0
Invoking A() ClassInvoking B() ClassInvoking A() ClassInvoking A() Class
Output for 5.3.18 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/rqdov on line 29
Process exited with code 255.