Many of us have contempt for earlier versions of ourselves.
Many of us started on PHP, hacking together wordpress and joomla and drupal sites, etc. We cut our teeth on it. We went from incompetent to competent on it. But then we decided we wanted to be something bigger, something better, something more professional. So we jumped on the flavor of the month (a few years ago it was RoR, now it's Node, soon it'll be Golang) and we never looked back. Since this hot-new-thing looked and acted and felt nothing like the old thing, we figured the new thing was good, and therefore the old thing was bad.
Now the new junior programmers remind us of our old selves. We've got no patience for it. It makes us uncomfortable to think that we were ever that new, ever that unseasoned or naive. They're using PHP? Oh well that only reinforces that I'm above it now. In this way our disdain for PHP is only a self-congratulatory indulgence. We're patting ourselves on the back for making that choice to leave it behind.
Like the bullies in the hallway at school, we're just a bunch of insecure people. And that's why we keep shoving PHP into a locker.
It's main strength is as a server-side rendering language, with everything else bolted on. That's fine if your requirements are simple. It's not really practical to make that work side-by-side with mobile clients. Developers are finding languages that provide asynchronous (node) or concurrent (golang) features to be more important when you're mapping data from many different sources to json output.
It's worth noting that Ruby and Python don't really provide those things either, but have much better reputations as back-end languages. I don't think that will last though. I can easily picture a world where people say, "LOL Ruby! That's what we used in boot camp!"
What I dislike about (server-side) PHP:
- Ugly syntax. For the languages with algol-inspired syntax, I feel PHP has the most oddities: "$", "=>", foreach (collection as iterator), etc.
- Inconsistency in the standard library. Naming - does the function I want have an underscore or not? isset doesn't, is_array does. The ordering of function arguments is also often different from one function to the next. IDE or php.net can help you with this, but when you're in a productive flow, this is an unnecessary impediment.
- Doing OOP in PHP, you get a lot of the verbosity of a language like Java without the type safety or standard library features. Nested arrays are common because there is a distinct lack of useful data structures in the language. Arrays are used as a mishmash of array/linked list/hash map because the language doesn't differentiate, leading to subtle bugs.
- As a dynamic language, I feel it compares unfavorably to Python in just about every meaningful way. Much more verbose than Python (list, generator and dictionary comprehensions, for example, cut down on a lot of boilerplate in Python.) Less powerful metaprogramming (in Python you can override __setattr__ to execute code whenever attributes are set; in PHP you can define __set magic attribute which doesn't work on public attributes, limiting its usefulness.) The standard library is less useful. It's not as simple to package and deploy.
- Modern features are starting to creep into in the language, but I feel it's too little too late. We recently had to upgrade a server to PHP 5.5 because I sold decision makers that using generators to stream data would result in much more maintainable code than shoehorning what we were trying to do into iterators. For a moderately large company with enough legacy, upgrading the PHP version can be an ordeal. Python has featured generators since 2003.
- I do feel that quality of candidates is an important consideration. A lot of people cut their teeth on "HTML, CSS and PHP" before moving up to "real" programming languages. The rate of applicants who don't have strong programming ability will be higher for PHP than for comparable languages.
I've been using PHP professionally for almost a year and I would never use it for a project unless it was already in use.
-- Bjarne StroustrupYou should have stopped there. :-)
Viva Scala!
But then again, what was the other option, Perl? Evolution picks a direction and runs with it.
Early PHP was really just a scripting language interface to C and the Web. And from that it evolved very quickly picking up all kinds of technologies along the way.
[1] http://dev.mysql.com/doc/refman/5.1/en/mysql-real-escape-str...
That's not really right, though. There are a ton of languages fighting for the server side web development crown.
I'd argue that if you limit it to LAMP, Python is a lot nicer than PHP.
Regardless, my current vote is for Scala world domination. Let the haters hate. :-)
I feel like PHP is just a very dull work horse with a lot of legacy code devs have to churn through. It doesn't really do anything new or sexy. It kind of globs features from other popular languages long after those features have been tried and tested.
"There are only two kinds of programming languages: the new hotness (node, etc), and oldskool PHP"