Question: Can anyone help with the Web programming assignment ?? ===== Topics print date three ways to code a php file Description Create a php script
Can anyone help with the Web programming assignment ??
=====
Topics
date
three ways to code a php file
Description
Create a php script that will display current date and time using the php date function. For output see the Input/Output section. Provide three different versions of the script each written in a different way as presented in the implementation section.
Implementation
Create three php scripts date1.php, date2.php, and date3.php. Each script will display current date and time using the php date function. However, write the each php script in a different way as shown below:
PHP script form 1: Dont output HTML tags
//Dont output html tags (they are implied)
php
?>
PHP script form 2: Output HTML tags within PHP tag
//Output html tags from within the php tag
php
print ;
print ;
?>
PHP script form 3: Output HTML tags outside the PHP tag
//Output html tags from outside the php tag
php
?>
Sample Code
Script date1.php will consist of only a few print statements for displaying the date shown below.
print "Today's Date: ";
print date("m/d/y h:i:s e");
?>
Script date2.php will consist of several print statements. The print statements will be used to output html tags from within php tag;
print "";
print "
";print "";
print "
";print "Today's Date: ";
print date("m/d/y h:i:s e");
print "";
print "";
?>
Script date3.php will be an html page with a php tags sprinkled in it as shown below.
Today's Date:
print date("m/d/y h:i:s e");
?>
Input/Output
Output
The output from each of the above script will be as shown below:
Today's Date: 09/07/14 07:03:54 US/Pacific
Configuring Time Zone
If time zone is not correct, rectify it by changing it in the configuration file as below:
Go to the file php.ini (file type is: Configuration settings
(In the file explorer, the ini file extension may not show. You will recognize the file from it file type)
(Make a backup copy of the file and call it phpOrig.ini)
Open php.ini using MSWord or Word Pad
Search for timezone in the file
Change the time zone line in the file as follows:
date.timezone = US/Pacific
Save the php.ini as a plain text (text only) file
Re-run the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
