3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { static $someFunction; // Throws error. static function foo() { static::${someFunction}(); } // Works static function bar() { $func = static::$someFunction; $func(); } } A::$someFunction = function() { print "wtf\n";}; A::bar(); A::foo();
based on jYWFO
Output for 7.2.0
wtf Warning: Use of undefined constant someFunction - assumed 'someFunction' (this will throw an Error in a future version of PHP) in /in/Qvi4J on line 8 Notice: Undefined variable: someFunction in /in/Qvi4J on line 8 Fatal error: Uncaught Error: Function name must be a string in /in/Qvi4J:8 Stack trace: #0 /in/Qvi4J(21): A::foo() #1 {main} thrown in /in/Qvi4J on line 8
Process exited with code 255.
Output for 7.0.0 - 7.1.10
wtf Notice: Use of undefined constant someFunction - assumed 'someFunction' in /in/Qvi4J on line 8 Notice: Undefined variable: someFunction in /in/Qvi4J on line 8 Fatal error: Uncaught Error: Function name must be a string in /in/Qvi4J:8 Stack trace: #0 /in/Qvi4J(21): A::foo() #1 {main} thrown in /in/Qvi4J on line 8
Process exited with code 255.
Output for 5.3.20 - 5.6.28
wtf Notice: Use of undefined constant someFunction - assumed 'someFunction' in /in/Qvi4J on line 8 Notice: Undefined variable: someFunction in /in/Qvi4J on line 8 Fatal error: Function name must be a string in /in/Qvi4J on line 8
Process exited with code 255.