3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A{ private function __invoke(){ return 'Object called as a function'; } } $w = new A(); echo $w->__invoke();
based on IFq65
Output for 7.0.0 - 7.2.0
Warning: The magic method __invoke() must have public visibility and cannot be static in /in/kNtm4 on line 4 Fatal error: Uncaught Error: Call to private method A::__invoke() from context '' in /in/kNtm4:12 Stack trace: #0 {main} thrown in /in/kNtm4 on line 12
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Warning: The magic method __invoke() must have public visibility and cannot be static in /in/kNtm4 on line 4 Fatal error: Call to private method A::__invoke() from context '' in /in/kNtm4 on line 12
Process exited with code 255.
Output for 5.3.21 - 5.4.45
Fatal error: Call to private method A::__invoke() from context '' in /in/kNtm4 on line 12
Process exited with code 255.