If..else php statement using times?

l.jessops

New member
I want to create a php statement which changes a sentence depending on the time of the day.
E.g. At the moment I have this:
<?php
$d=date("D");
if ($d=="Sat") echo "It is Saturday";
elseif ($d=="Sun")
echo "It is Sunday";
else
echo "It is a weekday";
?>

How could I edit this, so that it answers depending on the time of the day.
So if it was before midday, it would say 'Good Morning', and good afternoon for after midday.

Its probably very simple, but I've only just started learning php, so any help would be great!
And then, if you wanted to say like..
If the time < 12, and day of the week is Saturday, echo "It is Saturday Morning"
How would you write that?
 
Back
Top