Beginning PHP Programming

Introduction to Development Using a Hypertext Preprocessor Language

© Guy Lecky-Thompson

Answering the question: What is PHP and PHP Programming? A beginner's tutorial-style PHP introduction article, targeted at command line, GUI and web developers.

Introduction

Originally, PHP was designed for creating dynamic web pages. Its original name was Personal Home Page, reflecting the web development leaning. This name has since been updated to PHP: Hypertext Preprocessor, in recognition of a much wider target developer audience than originally intended.

Indeed, PHP programming now includes many capabilities and platforms, largely thanks to an active developer base offering many free extensions and modules for download under the PHP and GPL licenses.

There being no formal ANSI specification for the language, it is solely managed by The PHP Group, who produce the 'official' version. Being Open Source, however, it is inevitable that various individuals have built localized, specialized, or just platform-dependent versions. This serves to increase the reach, and helps spread the popularity of PHP as a programming language in its own right.

What is PHP used for?

PHP can be used to write programs almost any platform or technology. However, the most widely supported uses are for creating:

Out of the box, PHP is only really capable of servicing the first of these. In conjunction with a suitable web server, or web host providing access to server side scripting, PHP can be used immediately to create a dynamic aspect to web pages. This is discussed in the PHP Programming with HTML Documents article.

However, with the addition of libraries such as the curses (for command line - see Understanding Unix Curses Programming) and GTK (for GUI applications), both available as Open Source, PHP can be used as a client side programming language, too. Most of the commonly available binaries support local programming as well as server side development, making web development easier for those working with a remotely hosted web service.

Where can PHP be downloaded?

The offical source of the PHP language, www.php.net, has builds for Windows and the complete source code for Linux users. The Unix/Linux source code must be used to build the official PHP implementation, binaries are only provided for Windows. However, third parties have created platform-specific 'official' versions, recognized by The PHP Group for:

These are all accessible from the PHP site (www.php.net). Most good web hosts will also provide access to the most recent PHP version.

What is the language structure?

For those who just want to be able to understand the various templates in CMS such as Drupal, Joomla, PHPbb and so on, it is worth noting that PHP code will usually be included in an HTML document like so:

<?php
// PHP Code
?>

This is then interpreted by the web server before the page is rendered as HTML for delivery to the client browser. The most common way to output text is with the echo command: text can be plain or HTML; it is the end-user client browser that will interpret it.

The style of the language is similar to C, in that the syntax for decision making, looping, and so forth are almost identical to C. The various processing libraries, however, are different, so none of the familiar string.h, stdio.h or other ANSI libraries can be included. PHP does, however, provide its own, and these are supremely well-documented.

Where do I go from here?

To get started with PHP, we have some introductory articles:


The copyright of the article Beginning PHP Programming in PHP Programming is owned by Guy Lecky-Thompson. Permission to republish Beginning PHP Programming must be granted by the author in writing.




Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo