Some days ago during a water-cooler chat I heard my co-worker saying that PHP is not advanced, it feels like a toy! I respectfully disagreed with him but could not settle this during the chat. He is a hard-core Java developer, so I thought instead of settling it in an arm wrestle (he’s a big guy too), I’d rather cook up a blog post explaining why I think PHP is so not a toy.

On further discussion we found out why PHP felt like a toy to him and others.

Some reasons are the following -

The language is too easy to learn
It gets things done so easily that the developer cannot take the pride of creation
Cannot code things from ground up
Cannot do much rapid application development like that in Java SEAM
Hard to debug

I’ll address these comments one by one and add some of my own views too.

1. The language is too easy to learn

I always thought this was a good thing. If a language is easy to learn you can get your developers going much faster and be more productive. They will spend more time producing quality software than fighting with the implementation language.

2. It gets things done so easily that the developer cannot take the pride of ownership

I agree this is a nuisance. As an engineer I too want to take pride from designing phenomenal software that solves a real world problem. However, if a programming language is easy to use, once again you can spend more time focusing on the problem at hand than the implementation language. If PHP gets things done easily, then go ahead use the power of this language and solve more complicated problems! That will definitely give you the pride of ownership when you see your software being used by thousands of people.

3. Cannot code things from ground up, like that in C/C++

This is a bit tricky indeed. C/C++ is a very low level language. Nowadays C++ is really used for mission critical real time systems, operating system development, desktop software and the like. PHP is a scripting language that was designed to solve the “web problem”. PHP was solely designed keeping the Web in mind, hence the powerful string manipulation and HTTP libraries. So it boils down to using the right tool for the right job. If PHP codes websites better go with it .. if not try something else. I have coded in Python, Java EE, Erlang, C++ and so far haven’t found a good reason to not choose PHP for a web project.

4. Cannot do much rapid application development in PHP .. like that in Java SEAM

Now this is true! PHP is a language and we are comparing the language PHP with a Java framework SEAM. This won’t give us the complete picture. We need to compare PHP with Java and then a PHP framework with a Java framework. So the comparison is really between the PHP frameworks – CodeIgniter, Symfony,CakePHP and the Java frameworks – SEAM, Spring, Struts, JSF. So far I have not seen a Java framework (talking about SEAM and JSF) do something better than that in a PHP framework (CodeIgniter, Smarty and Symfony). Yes there is better IDE support for Java than there is for PHP, but frameworkwise it’s hard to convince me that a PHP technology is lagging behind in any way than the others. We can do rapid application development in PHP too .. just need to use the right PHP framework.

5. Hard to debug

Ok this I do not have an answer to because we still use var_dump($my_var) to debug our php applications or write something to the logs to step through the execution of a script. Yes this is one area I may agree that PHP is lacking. The IDE of of choice for us is Eclipse and if we can’t hook up a PHP debugger with Eclipse it’s not good! I know there is the Zend debugger for PHP and the Eclipse PDT.  But we have not tried these yet. May be I’ll cover this in a blog post of it’s own.

I’ll be interested to know what other people think of  PHP.

Talk to us