Tuesday, August 19, 2008

Hello PHP - My First !

This is my very first PHP programming, am delighted to apply what I have been reading about all this while. The file (.php) didn't work when opened locally in FireFox I was not surprised at all, in my reading I found out that extension .php is a dynamic web page and requires some server side technology for execution.

Analysing this php date code was very exciting, though my first but I have learnt php is very powerful programming language.

After doing my research and reading the date reference table provided on the page, all started to make sense. Basically I rearranged the parameters (strings) to display the date in "Monday 15th August 2008 03:12:46 PM" format.

This is my interpretation of the php date code:

// new format: ('l jS \of F Y h:i:s A');

l (lowercase) - Tuesday (day);
j (lowercase) - 19 (date;)
S (uppercase) - th (suffix);
F (uppercase) - August (month);
Y (uppercase) - 2008 (year);
h (lowercase) - 07 (hour);
: - colon
i - 55 (minutes);
s - 56 (seconds;)
A (uppercase) - PM (Post meridiem);

The new date format script as follow:

echo "The date is: ";
echo date('l jS \of F Y h:i:s A');
?>

Result: http://jack-dmt.site88.net/week4/week4prac.php

No comments: