I've been young - I needed the money
Note: This article was originally published at Planet PHP on 24 February 2011.
I've started using PHP in 2006 and used it almost exclusively until the end of 2009. I believe I've learned most of what one can learn about PHP in this time. In 2010 I started to work in Java and only started to understand how limited PHP is.
I know that java is far from perfect. So I don't stop there and already started to learn Scala and looking forward to learn other languages too. But Java is for sure a better answer then PHP, regardless what the question was.
There are many reasons, why you should not, never, for no project ever use PHP. I'll only tell you my personal top reasons:
- PHP is neither strictly nor statically typed. I fail to see any advantage in dynamic typing. But there are many advantages in compile time checks, automatic refactoring, call hierarchies and many other goodies that every IDE gives you for java.
- The first time I introspected a running JVM with jconsole and could peek into the inner workings of my application, I knew that PHP is a childish language. The JVM is great, its tool support is great. PHP does not give me nearly as elaborate development tools as the java world.
- PHP5 copied its object orientation syntax from Java (at least it looks like this). PHPUnit is a great tool (thank you SB!), but it's still only a very good copy of JUnit. Why not just use the original?
- PHP is typically choosen because initial development is very cheap. PHP programmers are much cheaper then java developers and you can move faster with PHP. The resulting projects however become a mess of unmaintainable code sooner or later. Nobody wants to work on the code anymore and shops with such PHP code burn one developer after the other to keep the crap running.