3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Direction { const NORTH = 2; const EAST = 4; const SOUTH = 8; const WEST = 16; const UNKNOWN = PHP_INT_MAX; static function getDirectionName($direction) { switch ($direction) { case (Direction::NORTH): return "North"; case (Direction::EAST): return "East"; case (Direction::SOUTH): return "South"; case (Direction::WEST): return "West"; case (Direction::NORTH | Direction::EAST): return "Northeast"; case (Direction::SOUTH | Direction::EAST): return "Southeast"; case (Direction::NORTH | Direction::WEST): return "Northwest"; case (Direction::SOUTH | Direction::WEST): return "Southwest"; case (Direction::UNKNOWN): return "Unknown"; default: return "No Match"; } } } echo Direction::getDirectionName(Direction::UNKNOWN);
Output for 5.0.5 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Unknown
Output for 5.0.0 - 5.0.4
Notice: Use of undefined constant PHP_INT_MAX - assumed 'PHP_INT_MAX' in /in/g2bBX on line 39 Unknown
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/g2bBX 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_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/g2bBX 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/g2bBX on line 5
Process exited with code 255.