3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class ClassA { private static $someVariable = 99; public static function setVariable($newValue) { self::$someVariable = $newValue; } public static function getVariable() { return self::$someVariable; } } ClassA::setVariable(42); echo "Static var is currently " . ClassA::getVariable() . "\n"; echo "default val is: "; $reflectionClass = new ReflectionClass('ClassA'); var_dump($reflectionClass->getDefaultProperties()); echo "\n";
Output for 5.2.4 - 7.1.0
Static var is currently 42 default val is: array(1) { ["someVariable"]=> int(42) }
Output for 5.0.0 - 5.2.3
Static var is currently 42 default val is: array(0) { }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/jZUpX on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/jZUpX on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/jZUpX on line 5
Process exited with code 255.