Jayne Herbert
Server Side Programming (PHP) Course
CITN270 – September 2009

Home - assignment 1 - assignment 2


 

 

Code snippts

 

Elseif - elseif example

This will message will say "Make the most of today its Sunday - back to work tomorrow, " and show the date tommorrow only if it is a Sunday.

If it is Monday it will say "Have a nice Monday", if it is neither of these it will say "Have a nice day this beautiful" and what ever the day is.

 

 

$today=date("D");

if ($today=="Sun") echo "Make the most of today its " . date(l) ." - back to work tomorrow, ". date('l jS F ', strtotime('+1 days')) ;

elseif ($today=="Mon") echo "Have a nice " . date(l) ;

else echo "Have a nice day this beautiful " . date(l) ;

 

Have a nice day this beautiful Friday

 

Note: The (D) in the date function defines the format of the output as a three letter interpretation of the weekday ie Thu not Thur or Thursday.

I have used the strtotime function to calculate the addition of one day to give tomorrows date.

 

 

 


 

 

phpcourse.jayne-herbert.co.uk