3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyBool { const MY_TRUE = 1; const MY_FALSE = 0; private $_type; private function __construct($type) { $this->_type = $type; } function Type() { return $this->_type; } static function MyTrue() { return new self(self::MY_TRUE); } static function MyFalse() { return new self(self::MY_FALSE); } } var_dump(MyBool::MyTrue());
Output for 5.3.0 - 7.2.0
object(MyBool)#1 (1) { ["_type":"MyBool":private]=> int(1) }
Output for 5.0.0 - 5.2.17
object(MyBool)#1 (1) { ["_type:private"]=> int(1) }
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/Pteod on line 3
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/Pteod on line 3
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/Pteod on line 3
Process exited with code 255.