PHP PHP Basics Daily Exercise Program Daily Exercise Program

alan ingram
PRO
alan ingram
Pro Student 3,979 Points

I straight copied hers and now it wont run after I made one change - changed it back.

<?php
//store each exercise in string
$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
$day = date('N');
var_dump($day);
// use an if statement to test for the day of the week
if ($day == 1){
  echo $exercise1;
}
if ($day == 2){
  echo $exercise2;
}
if ($day == 3){
  echo $exercise3;
}
if ($day == 4){
  echo $exercise4;
}
if ($day == 5){
  echo $exercise5;
}
if ($day == 6){
  echo $exercise6;
}
if ($day == 7{
  echo $exercise7;
}
// display the corresponding exercise string







?>

1 Answer

alan ingram
PRO
alan ingram
Pro Student 3,979 Points

found it myself. Odd, it would run but not give me the phrase print out, only the date # before. now it gives me both. go figure. The fix shouldnt have allowed the prior to begin with.