<?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);
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.
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.