PHP – A Vastly Superior Scripting Language

March 10, 06 by kenrich

I am continually amazed at the simplicity of web scripting using . Unlike Active Server Pages, you can perform complex tasks using only 1/3 the amount of code. Not only does this make the code easier to write, it is easier to read and maintain as well. When I first started Orvado, I wanted to develop all our code under PHP – I sure wish that we had gone that route now!

As an example, I had to write some code to load a template into a variable. Although file_get_contents() exists in PHP 5, I wanted something more portable so I used the function file. Using one function, I did the work that would take at least three lines in Active Server Pages. As I’m writing PHP, I find that the code is much easier to understand and maintain than the best ASP.

Another advantage of PHP is the huge variety of functions available to you. Unlike ASP which has somewhere around 200, PHP must have more than 1000. Many of the problems facing web developers have already been tackled by other PHP developers. I often find useful algorithms in the comments section of the PHP documentation. Common tasks such as “file upload” that require a specialized ActiveX component in ASP, are part of the core PHP language.

This brings me to one of the downsides of PHP – keeping track of which functions are supported in each version of PHP. If you want to make your code portable between many different servers, you will probably want to have compatibility with the lowest version of PHP (version 3.0 is probably as low as you want to go.) The good thing is that the PHP documentation site indicates the compatibility for each function. You can even write code that checks the PHP environment the script is running under and account for the functions that are available in that version.

This entry no have comments... but you can be first.

Leave a Reply

You must be logged in to post a comment.