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; } ] ] ]; print_r(get_class_methods('stdClass')); echo $obj->a->__invoke(); echo $obj->b->__call('ba'); $obj->b->bb->bba->__invoke();
based on kBnaf
Output for 7.0.0 - 7.2.0
Array ( ) 1 Fatal error: Uncaught Error: Call to undefined method stdClass::__call() in /in/8CiiB:14 Stack trace: #0 {main} thrown in /in/8CiiB on line 14
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Array ( ) 1 Fatal error: Call to undefined method stdClass::__call() in /in/8CiiB on line 14
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/8CiiB on line 3
Process exited with code 255.