Daily Exercise Program6:24 with Alena Holligan
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
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().
- 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.
You need to sign up for Treehouse in order to download course files.Sign up