Source Code:
(back to article)
<?php const DAY_MONDAY = 1; const DAY_TUESDAY = 2; const DAY_WEDNESDAY = 3; const DAY_THURSDAY = 4; const DAY_FRIDAY = 5; const DAY_SATURDAY = 6; const DAY_SUNDAY = 7; $day = DAY_MONDAY; echo $day . PHP_EOL; // Outputs 1 $day = DAY_TUESDAY; echo $day; // Outputs 2 $day = 10; // This would generate an error, as 10 is not a valid enumeration value
Result:
Report an issue