| |
Introduction to PHP
PHP is a fast, mature and very flexible scripting language and may be used in a wide
variety of situations. It started as a language to aid in building web pages, and that is
still the main use of PHP. It is also a powerful scripting language that can be leveraged
to replace Shell scripts on UNIX and Linux servers, or as a much more capable replacement
for the Windows/DOS batch programming system.
PHP is open-source, it is all of the things mentioned above, and it has one more very
important quality: It has widespread coverage in the press (many hundred books available
on the subject) and with developers around the world. That means if you decide to have your
application or web site programmed in PHP, that there is an extremely good chance that
the technology will be easily supported in the future.
PHP may be used to make static pages dynamic
What this means is that PHP allows for static web sites (sites that don’t change) to
be quickly modified to have dynamic behavior. For example: If you have the need to display
custom information for clients, a secure log-in system can be added to your site. After
logging-in, the user could be presented with their account information or have the
information presented according to their preferences.
Just take a look at a few simple examples. Following are two scripts. The first is
pure HTML and demonstrates a common problem of static websites:
Example 1 - Pure HTML with a problem
<HTML>
<BODY>
Copyright 2006
</BODY>
</HTML>
|
The problem with this web page, is that it will always show the visitor that
your site is copyrighted in 2006, until you pay someone to update that page.
Now see what happens if we add a bit of PHP
Example 2 - HTML with PHP
<HTML>
<BODY>
Copyright
<?php echo date("Y"); ?>
</BODY>
</HTML>
|
This small piece of PHP code (highlighted in red) will automatically display the current year without changing
this web page.
|
Other things that PHP can do:
- Writing desktop applications
- Processing and/or creating XML Data to interface with other systems
- Creating graphics (JPEG, GIF, PNG, and others)
- Creating Flash movies
- Creating PDF files
- Interface to a wide range of Databases:
- Oracle (OCI7 and OCI8)
- MySQL
- Sybase
- IBM DB2
- Informix
- ODBC Databases, like MS SQL Server
- PostgreSQL
- ... and many others
- ... and many, many more
|
|