Hi there,
I am wanting to display text based on what month of the year, the below code is what I’ve got, I wanted to check that it’s clean and there aren’t any unnecessary bits of code in it?
<?php $now = new DateTime(); $month = (int)$now->format("m"); if ($month >= 1 AND $month <= 1) { echo "Group B"; } elseif ($month >= 2 AND $month <= 2) { echo "Group A"; } elseif ($month >= 3 AND $month <= 3) { echo "Group B"; } elseif ($month >= 4 AND $month <= 4) { echo "Group A"; } elseif ($month >= 5 AND $month <= 5) { echo "Group B"; } elseif ($month >= 6 AND $month <= 6) { echo "Group A"; } elseif ($month >= 7 AND $month <= 7) { echo "Group B"; } elseif ($month >= 8 AND $month <= 8) { echo "Group B"; } elseif ($month >= 9 AND $month <= 9) { echo "Group A"; } elseif ($month >= 10 AND $month <= 10) { echo "Group B"; } elseif ($month >= 11 AND $month <= 11) { echo "Group A"; } elseif ($month >= 12 AND $month <= 12) { echo "Group B"; }