Trying to use the code below, which was originally provided in this question: PHP and Enumerations, but running into a problem.
abstract class DaysOfWeek
{
const Sunday = 0;
const Monday = 1;
// etc.
}
$today = DaysOfWeek::Sunday;
How do I call that method (or whatever it is) with a variable (instead of Sunday I have a variable $day, which has the value of Sunday). Have tried $today = DaysOfWeek::{$day};
, but it produces an error.