#native_company# #native_desc#
#native_cta#

PHP Basics: Intro to PHP Page 2

By Stirling Hughes
on December 18, 2007

The function of this code is simple. First we start off the
document with the normal HTML headers, nothing new there. What is
new is the material on lines 6 through 9; here we see simple PHP
code which will print out the current date. Here is a line by line
explanation of what happens in lines 6 through 9:
Line 6: Tells the PHP preprocessor that the PHP code has begun.
This is like the <html> at the beginning of the document
which tells the Web browser to treat the document as an
HTML language.
Line 7: A lot going on in this line – first we initialize (assign
a value to) the variable $date. The value is a formatted
date generated by PHP’s built in date function.
Line 8: Here we use the built in print function to print the
variable $date out on the screen.
Line 9: Tell the preprocessor to stop interpreting PHP code.
This is a basic example of PHP’s features, and a little bit of
source code to give you the idea. This article’s purpose is to
introduce PHP, rather than write a tutorial on PHP. Subsequently,
I’m not covering the syntax in depth but rather giving a taste of
the language. Other tasks that PHP is especially good at are
database access, disk access, networking and text manipulation.
You can find articles that cover these features on the sites
listed below.

Conclusion

In this article, we have discussed the motives for using PHP,
what PHP is and even gotten into writing some source code. We have
also gone over some of the history of PHP. However, this is meant
only as an introduction, to help you on your way to becoming an
experienced PHP programmer. For more information, I have provided
a list of links which will serve to help further your knowledge of
PHP. Happy trails!

Links

Author Info

Stirling Hughes can be reached at [email protected], or at
www.scalarsplit.com.