I want to know if there is a way to continue all three cases if they are all true, but using break, because as an example, if the first case is true, the second case is false, and the third is also false, and I do not use break , it will still be skipped. Change strtotime from October 6, 2014 and you will see what I mean
$date = strtotime("1 October 2014");
switch($date) {
case (date('l', $date) == 'Monday'):
echo "weekly<br>";
break;
case (date('d', $date) == '01'):
echo "monthly<br>";
break;
case ( ((date('n') % 3) == '1') && (date('d') == '01') ):
echo 'quarterly<br>';
break;
}
Any suggestion??? And if this is not possible using the switch, how can I do this if, to execute a line of code 3 times, one for each case.
source
share