Almost every major website whether the backend is developed in Java, PHP, Ruby or Python uses JavaScript in the browser. Even the competition Action Script (Adobe Flash) is a dialect of JavaScript. Any web developer has to learn JavaScript if they want to be any good at web development. So, if you have to learn JavaScript anyway, and you can use it for anything PHP can do, why spend the significant amount of time learning, coding, debugging, PHP?
Undeniably, JavaScript has weaknesses. JavaScript is also the most misunderstood programming language of all times. For this reason, one should get familiar with the core concepts of JavaScript in detail and understand them, if you want to develop using JavaScript in the browser or on the server.
PHP still a great language?
Now please don’t get me wrong, PHP is a great language that I use on a daily basis. It’s powerful, widely supported, popular, and pretty darn stable. Recently, I’ve even had even more success with PHP by supplementing it with CakePHP and Laravel, both very powerful PHP frameworks, which make development a bit more painless.
PHP works great. However, I just can’t recommend any new developer learn it anymore. PHP is great if you want a job in maintaining old/existing code bases. If you are doing any type of new web development, JavaScript is the way to go. Unless something significant happens in the PHP world, I do not foresee growth rates for PHP like we’ve seen in the past.
Google reckoned that PHP is present in 75% of the Web servers, and so they could not ignore the PHP market and added native PHP support to Google App Engine after 5 years reluctant to do so.
PHP, despite being called, one of the worst languages, is still and has a massive community behind it, which is an indicator for a progressive language, not a dying one. PHP is more mature than it was a few years ago – and a little cleaner. There are better tools. The whole experience is just better.
But let’s assume that PHP will slowly be losing ground to Ruby and/or Python: even in 20 years there will still be PHP developers, because old programming languages almost never die. The supporters do. Even now there are people out there maintaining PL/1 or FORTRAN or COBOL code. The same will be for PHP and Ruby and Python when they finally fall out of favor.
However, JavaScript is doing some amazing things right now. It matured. It’s still got that low barrier to entry, but there are more tools in the toolbox to use it effectively. In fact, people had to LEARN to use it effectively and now, more than ever, JavaScript is having a resurgence.
One interesting development, just mentioning, in the PHP/Node.js debate is Automattic’s purchase of CloudUp. Maybe the CloudUp team can help PHP out, or maybe it will lead to an acceleration of the switch from PHP to Node.js.
Realtime Synchronization with JavaScript
JavaScript-Web-Frameworks flourish and with the ever growing wish to develop a Realtime Web – there has to be a change of paradigm. Let’s take Derby.js, I’ve never seen a framework like it, realtime-synchronization-of-the-client-and-server-wise. Derby enables the developer to write an application in which two users edit the same text field–live without getting caught up in all the details. Essentially a Google Docs collaborative editing tool.
Another framework similar to Derby.js is called Meteor. Similar to Derby, it handles things such as updating views live across multiple clients. Meteor looks like a pretty interesting option when creating an app that requires realtime feedback. Meteor recently received $11M+ in funding.
The Meteor team notes that some of the biggest names in web apps — Facebook, Google, Twitter, etc. — employ roughly the same technique. Meteor just scales it down for teams and apps that don’t have an army of high-genius developers at their disposal. – Source: VentureBeat
Every solution to a problem can comprise a different approach on how to get to the goal. It is all about a set of requirements and its implementation. While Meteor is a pretty cool to work with and there are some pretty useful applications for it, like Derby.js, it is immature. Hopefully the $11M in funding will be put to good use. Nevertheless, PHP will still remain a very strong tool to develop web apps. Hence, I don’t really think PHP will die but it will certainly have to adapt to remain in its current roll!