3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if(version_compare(PHP_VERSION, '5.0') < 0) { die(); } class Concrete5_Helper_Date { const CONST1 = 'core1'; const CONST2 = 'core2'; public static function test1() { echo "test1.self: ", self::CONST1, ", ", self::CONST2, "\n"; echo "test1.static: ", static::CONST1, ", ", static::CONST2, "\n"; } } class DateHelper extends Concrete5_Helper_Date { const CONST2 = 'override2'; public static function test2() { echo "test2.self: ", self::CONST1, ", ", self::CONST2, "\n"; echo "test2.static: ", static::CONST1, ", ", static::CONST2, "\n"; } } DateHelper::test1(); DateHelper::test2();
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
test1.self: core1, core2 test1.static: core1, override2 test2.self: core1, override2 test2.static: core1, override2
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/Xmu67 on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STATIC in /in/Xmu67 on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/Xmu67 on line 6
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_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/Xmu67 on line 6
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/Xmu67 on line 6
Process exited with code 255.