I was recently asked to code a little widget for someone’s Eshop to display a message at a certain time of day to say if they were open or closed.
The shop’s opening hours were 8:00am – 11:30am then 4:00pm – 10:00pm.
= $open_AM && $t <= $close_AM)
{
echo "Shop Open";
}
else if($t >= $open_PM && $t <= $close_PM)
{
echo "Shop Open";
}else{
echo "Shop Closed";
}
//Plus 2 Hours
$t=time() + $offset;
echo "Plus 2 hours: ";
echo(date("D F d Y H:i:s",$t));
?>I will now break this code down for you.








