1st PHP Script - Exercise

Contact Us or call 1-877-932-8228
1st PHP Script - Exercise

First PHP Script

Duration: 5 to 10 minutes.

In this exercise, you will write a simple PHP script from scratch. The script will declare a variable called $today that stores the day of the week.

  1. Open a new document and save it as Today.php in the PhpBasics/Exercises folder.

    You must save the file in the c:\XAMPP\htdocs\Webucator\ClassFiles directory path.

  2. Declare a variable called $today that holds the current day of the week as literal text.
  3. Output $today in the title and body of the page.
  4. Test your solution in a browser. The resulting HTML page should look like this:HTML Page


Instead of assigning a literal string (e.g, "Monday") to $today, use the built-in date() function so that the script won't have to be manually updated every day to stay current. For documentation, visit http://www.php.net/date.


	$today = 'Monday';
<meta charset="UTF-8">
<title><?php echo $today; ?></title>
	echo $today;

Challenge Solution:

	$today = date('l');
---- C O D E   O M I T T E D ----