Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
In this video we'll take the concepts we've learned to develop a daily exercise program. We'll use variables and conditionals to show us a different exercise each day.
Starter Code for Daily Exercises
// store each exercise in a string variable
$exercise1 = 'Display "Hello World!"';
$exercise2 = 'Convert Pounds to Kilograms';
$exercise3 = 'Convert Kilograms to Pounds';
$exercise4 = 'Convert Miles to Kilometers';
$exercise5 = 'Convert Kilometers to Miles';
$exercise6 = 'Month long string of the day';
$exercise7 = 'String of the day with levels';
// create a variable containing the day of the week
// use an if statement to test for the day of the week
// display the corresponding exercise string
Documentation
The date() function returns a string formatted according to the given format string.
'N' returns a numeric representation of the day of the week 1 (for Monday) through 7 (for Sunday)
To see all formatting options, visit the PHP Documentation for date().
Additional Practice
- Perform other conversions or mathematical computations.
- Add a skill level to your exercises and display an exercise by skill level as well as day.
- Create a quote of the day or
- Show a greeting based on the time of day.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
<noob />
17,062 Points5 Answers
-
PLUS
alan ingram
Courses Plus Student 3,979 Points1 Answer
-
Damian Toczek
4,471 Points2 Answers
-
Yogita Verma
5,549 PointsWhat is problem with my code? Only one condition should be printed but here each condition is being printed.
Posted by Yogita VermaYogita Verma
5,549 Points2 Answers
-
Kieran Barker
15,028 Points0 Answers
-
Sahan Balasuriya
10,115 Points2 Answers
-
Chris Sederqvist
7,596 Points2 Answers
-
Jason Brown
9,626 PointsProgram always returns today's date, no matter how many times I change the $day variable ...
Posted by Jason BrownJason Brown
9,626 Points1 Answer
-
Antonia Senta
2,085 Points3 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up