I have a class Constant in App\Utilities See Below:
<?php
class Constant {
const
WEEK_1 = 'Week 1',
WEEK_2 = 'Week 2';
}
?>
And I can echo Constant::WEEK_1 it gives me 'Week 1',
But what I want is to dynamically call constant week say
foreach([1,2] as $key => $num) {
echo Constant::'WEEK_'.$num
}
And Im getting a parse error.
How to do this? Anyone? Thanks