Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Usability

Web Design Reference Guide

Hosted by

PHP

Last updated Oct 17, 2003.

PHP is an acronym for PHP Hypertext Preprocessor. Though there have been arguments on its exact acronym, this is the one defined by the project Web site. PHP is an open source server-side scripting language that borrowed most of the syntax from C, with some C++, Java, and Perl added. Of course, it has its own features mixed in.

One of its strengths is its ability to be embedded within HTML, which is also its weakness because the code is for the Web and nothing else. Let's use the traditional "Hello, World!" example to see what PHP looks like:

In HTML:

Hello, World!

In PHP:

<?php print "Hello, World!"; ?>

Both methods give the same results of displaying Hello, World! on the screen. In this example, it looks like PHP is more work, but not when it comes to adding interactive and dynamic features. With PHP, you can modify the "Hello, World!" line to use the visitor's name instead of "World" or to say, "Hello" in the person's language of choice. PHP files use the .php, .php4, or .phtml extension instead of .htm or .html.

Unlike Perl/CGI, PHP has no need for a CGI-bin directory. It's similar to JavaScript in terms of syntax. PHP is often run on UNIX-based systems with Apache installed, though it can run on different platforms and servers including Windows, Linux, and IIS. Since PHP is an Apache project, the two are tightly integrated.

PHP scripts can be anywhere within your domain and are natively supported by SQL Server, MySQL, Postgres SQL, Informatix, and Oracle databases. PHP is a structured language like C, Java, and Perl. Structured languages are said to be harder for newcomers to programming to learn. On the other hand, it's not based on object classes, which makes it easier to learn.