PHP vs. JAVA - WHICH IS THE BETTER WEB LANGUAGE ?

 
by Eric Rowell on March 4th, 2010
FROM... http://onepixelahead.com/2010/03/04/php-vs-java-which-one-is-the-better-...
Traditionally, it seems like Java is the web language of choice for corporations, and PHP has been the web language of choice for people who own their own websites (i.e. small scale websites).  It also seems like both of these groups will swear by anything that their language, whether it be PHP or Java, is the supreme language of the universe. The purpose of this post is to help explain the apparent segregation between both groups while providing some guidance as to which platform to choose depending on your situation.
Two sides, two perspectives
If you ask most Java developers what they think about PHP, they will probably tell you that it’s a very basic, unprofessional language that can be messy, lacks structure, doesn’t have a good IDE (integrated development environment) like Eclipse or RSA, and isn’t a good platform for a real website.  If you ask most PHP developers what they think about Java, they will probably say that it’s overly complex and cumbersome, and that it isn’t a good platform because development time is just too slow and tedious.  Which side is correct?
The difference between PHP and Java
The root of this dispute boils down to the development of IDEs (integrated development environments) and how each language has handled objects over time.  Originally, PHP didn’t support OOP (object oriented programming) until PHP4, and didn’t have a strong IDE.  Since PHP 5.3 however, its support for OOP has improved tremendously.  Furthermore, in the past year or so, some really great IDEs have emerged to support PHP development.  Java on the other hand has always been uniquely defined by its OOP nature, and has has always had great IDEs.
Most new web programmers will turn to PHP simply because the language supports both OOP and proceedural programming, in which case the latter is easier to learn.  Novice web programmers often times don’t yet understand MVC architecture, and just build their web pages by querying a SQL database and printing the results with for loops directly, all within one PHP file.
Java developers, on the other hand, are usually well trained and very familiar with OOP.  Since Java seems to be the most common web language used in the corporate setting, these groups of people usually work in teams and fully utilize the conveniences of IDE’s and OOP.
PHP vs. Java in the past
Two years ago, this debate ultimately boiled down to how large your development team was.  If you were building an entire website by yourself, or with a group of less than three people, PHP was probably a better route because development was much faster, and you were less likely to step on your team member’s toes as you developed.  On the other hand, if you were building a very complex system requiring a large team of developers, say five or more people, you would have needed a very well structured, standardized architecture, to ensure that all of your developers were on the same page, especially in a corporate setting where you could have dozens or even hundreds of developers working on the same website. In these cases, Java was a much better choice.
PHP vs. Java today
Now that PHP has a variety of wonderful IDEs to develop in, and now also supports OOP just as effectively as Java, why aren’t more coporations switching to PHP?  The answer is simple.  Change happens very slowy in large corporations.  Furthermore, if your corporation is made up of hundreds of Java developers, and your entire system is already built in Java, how could it possibly make sense to suddenly switch to PHP?  It wouldn’t make sense.  As a result, most larger corporations are essentially locked into Java development, while smaller companies are more capable of building a foundation for their systems in PHP.
The future of PHP vs. Java
In my opinion, at the time of this writing, both languages are nearly on an equal footing, although PHP is easier to deploy because there’s no pre-compilation required.  We will begin to see larger corporations adopting PHP only when Universities begin to include it as a major part of their curriculum, and as the smaller companies that hire graduates fluent in PHP grow into large corporations.  In short, it could take many years before we really start to see a PHP presence in larger corporations.