I am working on some PHP code currently that seems to work logically
$tod = date("G");
if($tod >= 5 && $tod <= 11) { $work = "Morning's"; }
elseif($tod >= 12 && $tod <= 17) { $work = "Afternoon's"; }
else $work = "Evening's";
$dw = date( "l");
if($work = "Morning's") { $pre = "Morning"; }
elseif($work = "Afternoon's") { $pre = "Afternoon"; }
else $pre = "Evening";
For some reason if I try to increase or set the $tod variable to something in each range when I echo $work it always returns “Morning’s” no matter what $tod is set to. Is something wrong with my if..elseif..else statements? I’m not getting any errors when I load the page.
Thanks for the help
Try this you have forget “=” in two if