Why PHP?
PHP is an excellent choice for Web programming. It has many advantages over other languages, including other Web-oriented languages. To get a very general understanding of how the common Web programming languages compare, let’s compare them.
ASP is Microsoft’s Web programming environment. (It’s not a language itself because it allows the programmer to choose from a few actual languages, such as VBScript or JScript.) ASP is simple, but too simple for programs that use complex logic or algorithms.
TIP
An algorithm is a formula-like method for accomplishing a particular task. Here’s a simple example: Some bank accounts use the last four digits of a person’s Social Security number as his PIN number. An algorithm could be formed to create this PIN number based on the already-known Social Security number.
Besides ASP’s over-simplicity, many companies find it hard to budget for the expense of Microsoft licenses. Without even considering hardware costs, a Microsoft server could cost thousands of dollars in licensing, whereas a comparable Unix-based operating system running PHP could be free.
TIP
Many people new to open source software find the idea of free software hard to believe. However, once you’ve spent some time looking into it, you realize how much open source software makes sense. In addition to open source software being free, it is generally updated and patched more frequently, and it’s usually easy to find help from other users and even from the developers of the software.
You may be interested in visiting http://www.OpenSource.org for more information.
Another language well known for its use on the Web is Sun Microsystems’ Java. Java is praised for being platform-independent (a program written in Java can be run on virtually any computer without having to make any modifications to the program).
NOTE
The term platform means the same thing as operating system. Some examples include Windows, Solaris, Linux, FreeBSD, and NetWare.
Although Java does have its advantages, it has serious downsides in development time, development cost, and execution speed. Java development is time-consuming because projects in Java must follow strict rules (imposed by Java) that require extensive planning. In addition to high development time, the cost is also high because Java developers are expensive to hire. The cost is therefore potentially much higher than it would be if the project were done in another language. Even after the project is built, a program written in Java takes longer to run than one written in one of the other languages to which we’re comparing.
Overall, when compared to Java, PHP comes out with flying colors. It is not unheard of for a Java project to take two or three times the time to develop compared to a similar project in PHP. On top of that, the final program runs on a wide array of platforms (like Java), except the PHP program runs faster.
Another language commonly used for writing Web programs is Perl (practical extraction and report language). Perl, like PHP, is an open-source project developed to run on many platforms. In fact, Perl has been around longer than PHP. Before PHP, Perl was generally accepted as the best Web programming language. However, during the past few years, PHP has earned a reputation for being better than Perl for Web programming because PHP provides a vast number of features as part of PHP itself, whereas you would have to download separate modules to get the same functionality in Perl. This leads to problems when programs are transferred from one system to another because the modules have to be downloaded from Perl’s exhaustive (and confusing) module archive known as CPAN.
The last language to compare PHP to is C. C has been around for a long time; it has been used in a variety of computers, from mainframes to consumer PCs. The problems creating a Web program in C are obvious if you know C. To develop a Web program in C, you have to develop all of the basic functionality of Web programming (such as collecting the data from HTML forms) before you can even begin to think about the actual task at hand. Since PHP provides for all the common (and many uncommon) Web programming tasks, writing such a program in PHP allows the programmer to get straight to the point.
You could write volumes on PHP’s advantages over other programming languages when it comes to Web programming. There are many, many articles on the Internet comparing PHP to Java, Perl, ASP, and others. Once you’ve earned some experience programming in PHP, you might find yourself trying to convince your client or employer to allow you to use it instead of another language. If that problem arises, you should find plenty of helpful information by doing a Web search.
PHP has an unlimited number of uses. The original version was used solely to track who was viewing the creator’s résumé. Over time, however, that simple tracking program evolved into a language of its own.
TIP
If you’re interested in knowing how PHP came to be what it is today, I recommend visiting http://php.net/manual/en/intro-history.php, where you will find a brief history of the language.
PHP’s primary use certainly isn’t to track résumés anymore; it has grown to be able to do that and just about anything else. To giveyou a better idea of what PHP can do, here are some of its common uses:
Feedback forms
Shopping carts and other types of e-commerce systems
User registration, access control, and management for online subscription services
Guest books
Discussion and message boards