For many of us, the world of the Web and Technology in general is rather confusing one. One where anyone who knows anything can often be so proud of themselves that they won’t stop and take the time to explain anything to you. This article series is about the exact opposite. People who know contributing to people who don’t know. —By Jeremy C. Wright

In this article we will look at a whole new area, the area of Server-Side Scripting. In our previous article on Client-Side Technologies we saw things like normal HTML, CSS and JavaScript. In this article we will look at technologies which enable you to make HTML, CSS and JS dynamically and in an automated way. For instance, E-Bay does not hand-code each one of their auction pages, they use Server-Side Programming to automatically generate those pages for you whenever you request them.

This article will cover the scripting-languages which you can run server side. Scripting languages are interpreted, as opposed to compiled. They are easier to write but they also take slightly longer to run. For most developers it is a good trade-off, and it is few companies indeed who will run their entire website from a compiled language, though E-Bay is one of them.

Well, let's begin then, shall we?


PHP Definition [1]

PHP (PHP: Hypertext Processor) is an HTML-embedded, server-side, cross-platform scripting language used to create dynamic web pages. PHP is Open Source software.

PHP is a server side language designed to be able to handle web-based applications and processing. When a PHP script is requested from the server, it is parsed (read) for instructions that are then executed, the resulting HTML code is then sent to the browser. As PHP is Open Source it can be run on many servers such as Apache, IIS etc. This fact has lead to the rapid adoption of PHP by the web development community and it is now one of the most popular server side languages. The latest version of PHP, 4, is built upon the Zend parsing engine which was written by Andi Gutmans and Zeev Suraski. Andi and Zeev adopted the PHP language after version 2 and have been responsible for all major releases since (including a complete overhaul). PHP4 now includes support for many more Web servers, HTTP sessions, output buffering, more secure ways of handling user input and several new language constructs.



What It Really Is


So that's what PHP is on paper but what does it really do? Two things that are instantly attractive are that it is Open Source and so has a low development cost and that support and assistance are readily available through the active and helpful PHP Community. For experienced developers in Java, C, C++ or even JavaScript, the syntax of PHP is both logical and familiar. The developers have taken care to ensure that the language is not overly complicated by, for example, naming functions logically ie: strtoupper() and arraypop(). This makes PHP a solid language for anyone looking to take the leap from static HTML pages to dynamic web sites.

The most common application of PHP is, undoubtedly, web-based applications utilizing databases. PHP has an excellent interface to the Open Source database, mySQL, which means that developers can utilize these tools easily and effectively to create fast web applications. PHP provides support for many other databases as well including SQL Server, Oracle and MS Access. It has proven to be a viable and stable solution for everything from personal to corporate to E-commerce web sites. It also comes with a wide range of other features such as, XML support, Java servlet support, native session handling and IMAP functions amongst others. Overall PHP is a strong option for those looking to graduate from the basics of web design. As well as being easy to pick up it offers many advanced functions that experienced developers will appreciate.



Advantages

+ Strong support community
+ Ease of use for experienced developers
+ Installed on nearly all webhosts
+ Cross-platform
+ Open Source

Disadvantages

+ Strong learning curve for inexperienced developers
+ Security risks for new developers, due to the power PHP is given



Examples


For many, many examples of PHP usage, as well as the full manual, go to www.php.net/manual. Here are some standard types of things you might find.

PHP Start & End Tags

<?php.... ?> or <? ..... ?>



Display Configuration Information

<? phpinfo(); ?>

Comparison Operators

$a == $b
Checks if the value held in $a is the same as that held in $b

$a ===$b
Same as before but also checks if they are the same type (string, number)

$a != $b
Checks if the value held in $a is not equal to that held in $b

$a < $b
Returns true if the value held in $a is LESS THAN that held in $b

$a > $b
Returns true if the value held in $a is GREATER THAN that held in



Similar Technologies

Really, any Net-based scripting language is "similar" to PHP in that it fulfills the same goals, and we will look at most of these during the rest of this article series:

ASP: By far the most hated rival of the PHP community, ASP is Microsoft's proprietary scripting language. While it does run on Unix, under interpreter's such as Sun's ASP ONE, it shines on Windows NT and Windows 2000 machines.

ColdFusion: ColdFusion is Macromedia's offering for web-based dynamic content. While it isn't technically "scripting", as it is based on an HTML-like tag structure, it does fulfill the same goal of providing dynamic webpages.

 



+ article by Jeremy C. Wright
, about the author

+ [1] "PHP," by Anthony McGuiness & Edited by
Harry Fuecks




[ print ] [ top ]

 

Advertise at Scene 360:

Sponsor: MailChimp