3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Direction { static NORTH = 1<<1; static EAST = 1<<2; static SOUTH = 1<<3; static WEST = 1<<4; static UNKNOWN = PHP_INT_MAX; public function __construct($direction) { switch ($direction) { case (Direction::NORTH): echo "North"; break; case (Direction::EAST): echo "East"; break; case (Direction::SOUTH): echo "South"; break; case (Direction::WEST): echo "West"; break; case (Direction::UNKNOWN): echo "Unknown"; break; default: echo "No Match"; break; } } } $d = new Direction(Direction::NORTH);
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected 'NORTH' (T_STRING), expecting variable (T_VARIABLE) in /in/1KdRk on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/1KdRk on line 5
Process exited with code 255.