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 0SPfW
Output for 7.0.0 - 7.2.0
wtf Notice: Undefined variable: someFunction in /in/ShITJ on line 8 Fatal error: Uncaught Error: Function name must be a string in /in/ShITJ:8 Stack trace: #0 /in/ShITJ(21): A::foo() #1 {main} thrown in /in/ShITJ on line 8
Process exited with code 255.
Output for 5.5.0 - 5.6.28
wtf Notice: Undefined variable: someFunction in /in/ShITJ on line 8 Fatal error: Function name must be a string in /in/ShITJ on line 8
Process exited with code 255.