|No doubt much of its popularity is due to its relative ease to learn, and its notorious looseness. Arrays and variables in PHP are able to hold any type of object, variables need not be declared, and the syntax is remarkably simple.
|Unlike many languages, such as C# or Perl, which have primarily a following of more generalist programmers, many PHP programmers know no other language. This occasionally causes it to be dismissed as a lesser language, but its growing popularity and the many robust and efficient sites built using it as a structure seem to dispel this myth.
|PHP has occasionally been criticized for what are viewed by some as security flaws, in comparison to languages such as ASP. A lack of easily understandable error messages, a sometimes overly robust configuration file, and an obviously incomplete set of built-in functions are also pointed to as areas which could use marked improvement.
|Development continues apace, however, and with each successive build, PHP appears to address more and more of the concerns raised by its open-source community.
|PHP and other Languages
1. PHP vs. ASP?
2. PHP vs. Cold Fusion?
3. PHP vs. Perl?
|1. PHP vs. ASP?
|ASP is not really a language in itself, it’s an acronym for Active Server Pages, the actual language used to program ASP with is Visual Basic Script or JScript. The biggest drawback of ASP is that it’s a proprietary system that is natively used only on Microsoft Internet Information Server (IIS).
|This limits it’s availability to Win32 based servers. There are a couple of projects in the works that allows ASP to run in other environments and webservers: InstantASP from Halcyon (commercial), Chili!Soft ASP from Chili!Soft (commercial) and OpenASP from ActiveScripting.org (free).
|ASP is said to be a slower and more cumbersome language than PHP, less stable as well. Some of the pros of ASP is that since it primarily uses VBScript it’s relatively easy to pick up the language if you’re already know how to program in Visual Basic.
|ASP support is also enabled by default in the IIS server making it easy to get up and running. The components built in ASP are really limited, so if you need to use “advanced” features like interacting with FTP servers, you need to buy additional components.
|2. PHP vs. Cold Fusion?
|PHP is commonly said to be faster and more efficient for complex programming tasks and trying out new ideas. PHP is generally referred to as more stable and less resource intensive as well. Cold Fusion has better error handling, database abstraction and date parsing although database abstraction is addressed in PHP 4.
|Another thing that is listed as one of Cold Fusion’s strengths is its excellent search engine, but it has been mentioned that a search engine is not something that should be included in a web scripting language. PHP runs on almost every platform there is; Cold Fusion is only available on Win32, Solaris, Linux and HP/UX.
|Cold Fusion has a good IDE and is generally easier to get started with, whereas PHP initially requires more programming knowledge. Cold Fusion is designed with non-programmers in mind, while PHP is focused on programmers. A great summary by Michael J Sheldon on this topic has been posted to the PHP mailing list. A copy can be found here.
|3. PHP vs. Perl?
|The biggest advantage of PHP over Perl is that PHP was designed for scripting for the web where Perl was designed to do a lot more and can because of this get very complicated. The flexibility / complexity of Perl makes it easier to write code that another author / coder has a hard time reading.
|PHP has a less confusing and stricter format without losing flexibility. PHP is easier to integrate into existing HTML than Perl. PHP has pretty much all the ‘good’ functionality of Perl: constructs, syntax and so on, without making it as complicated as Perl can be. Perl is a very tried and true language, it’s been around since the late eighties, but PHP is maturing very quickly.
|4. PHP vs. JSP
|Function / Feature
|Completely object oriented Advantage: Clean code
|Scripting with object oriented support Advantage: Functional and quick coding, you can use OOP practices at your convenience
Disadvantage: May get clumsy
|String and data manipulation
|Rich library, too much descriptive and object oriented code
|Rich functionality. Functional and easy coding.
|Web Oriented features
- File Uploads
- Form Handling
|Almost everything is built in or supported by libraries. Complicated and too much of code.
|Inbuilt functionality. Easy to use functions, written for the specific tasks
|Database Access features
|Standard JDBC structure/ Use EJB/ Struts framework built over JDBC. Descriptive and too much overhead or boiler plate code involved. Uses the same API for all databases using JDBC drivers
|Dedicated inbuilt libraries for most of the commonly used databases. Very tight integration with MySQL and PostGRESQL. Very minimal boiler plate code required. The libraries and results are straight forward and easy to use.
|Use standard SAX/DOM parsers. Too much boiler plate code involved. Well defined APIs and stable implementations are available for XSL and XPATH
|SAX and DOM parsers available are easy to use and to the point. Another library, Simple XML provides very easy OO approach to handling XML data. XSL and XPATH functionality is also built in.
|Java Classes and Libraries. Run’s in sandbox and hard JNI approach needed to integrate with server programs.
|PHP/C/Any thing executable by the underlying OS platform. Can very easily interact with programs on the server. Very good support for native code.
|Dynamic Graphics/PDF and bells and whistles
|Almost everything has a readymade library
|Supported internally or though libraries.
|Addon Libraries like Axis, JAX-WS, etc.
|Spec JSR-168 and 286
|Many different Portal frameworks