3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $obj = (object) [ 'a' => function(){ return 1; }, 'b' => (object) [ 'ba' => function(){ return 2; }, 'bb' => (object) [ 'bba' => function(){ return 3; } ] ] ]; $obj->a->call(); $obj->b->ba->call(); $obj->b->bb->bba->call();
based on SaKdt
Output for 7.0.0 - 7.2.0
Warning: Closure::call() expects at least 1 parameter, 0 given in /in/aIKR7 on line 12 Warning: Closure::call() expects at least 1 parameter, 0 given in /in/aIKR7 on line 13 Warning: Closure::call() expects at least 1 parameter, 0 given in /in/aIKR7 on line 14
Output for 5.4.11 - 5.6.28
Fatal error: Call to undefined method Closure::call() in /in/aIKR7 on line 12
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/aIKR7 on line 3
Process exited with code 255.