<?php
class Month extends SplEnum {
const January = 1;
const February = 2;
const March = 3;
const April = 4;
const May = 5;
const June = 6;
const July = 7;
const August = 8;
const September = 9;
const October = 10;
const November = 11;
const December = 12;
}
$month = new Month(Month::June);
var_dump($month);
$month = 'aaa';
var_dump($month);
Fatal error: Uncaught Error: Class "SplEnum" not found in /in/1TZE0:4
Stack trace:
#0 {main}
thrown in /in/1TZE0 on line 4
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Class 'SplEnum' not found in /in/1TZE0:4
Stack trace:
#0 {main}
thrown in /in/1TZE0 on line 4
Process exited with code 255.
Fatal error: Class 'SplEnum' not found in /in/1TZE0 on line 4
Process exited with code 255.
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/1TZE0 on line 6
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/1TZE0 on line 6
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/1TZE0 on line 6
Process exited with code 255.