3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private function bar(){} function ba(): callable{ return [$this, "bar"]; } } $a = new A; $callable = $a->ba(); $callable();
based on 9aSt0
Output for 7.0.0 - 7.2.1
Fatal error: Uncaught Error: Call to private method A::bar() from context '' in /in/RfeSK:14 Stack trace: #0 {main} thrown in /in/RfeSK on line 14
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Invalid callable (array) in /in/RfeSK:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught Error: Invalid callable (array) in /in/RfeSK:14 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/RfeSK on line 7
Process exited with code 255.