There is a lot of good things to be said about PHP. Personally, I do not go along with the typical critique about it. Which usually points out edge cases of PHP's behavior which never have been a problem for me in real life.
At Gnod, we are heavily invested in PHP. And it continues to look like that was a good choice.
What I would like to see discussed more is PHP's decision of not having an import system but to instead use a "namespace" directive in included files. This puts the burden of avoiding name conflicts on the included file rather then on the including file. While in Python and Javascript it is the other way round. Which in my experience makes things more logical and requires less tooling for an enjoyable coding experience.
I don't know PHP very well, and don't understand what you mean. Are you saying if I write a library in PHP it's my responsibility to avoid name collisions with future user's code (some of which might not yet exist)?
Also, unfamiliar with PHP, but a few years ago I somehow ended up maintaining/managing one or two reasonably trafficked Wordpress sites that some (untechnical) friends put together, so every now again I get to learn how weird some shit in PHP is. And it’s that time again, because the comment about name conflicts was confusing as I could’ve sworn that during couple times I’ve had to actually poke around PHP code I saw it had namespaces. After some quick googling though, I was able to confirm a) PHP has “namespaces” and b) they seem to work like most other “features” (i.e. not like you’d expect if you’ve programmed in anything but PHP) [1].
However, C has the a similar convention [2] (though the convention is — as far as I’m aware — for the sake of maintainability/readability as the compiler has no problem telling the difference between to things named the same, the person reading it probably will. While, as I understand it, PHP will just overwrite anything with the same name in the file/lib you include).
It seems like PHP is heading in the right direction, but I have no idea why anyone would pick it up or start anything new with it these days, I don’t care how well done and the nice and new stuff is, it’s the decade of utter mess it’s built on top of that has uninterested me. Don’t get me wrong, since “acquiring” the Wordpress sites I’ve gone from a blind PHP hater, to at least understanding/appreciating it (but still won’t actually touch it with a 10ft pole). PHP is brain dead easy to deploy and scale up, compared to ruby/python/node (which aren’t _that_ difficult to deploy), PHP is basically the web equivalent of a static binary, in that you can just drop in and it’s basically ready to go. PHP also actually really fast, it’s seriously impressive how fast it can render WP pages especially when you consider the absolute spaghetti/thrown together/clusterfuck code it’s running — Wordpress itself is pretty yikes from the code I’ve seen, but the plugins, Christ, the 50 million sloppy buggy poorly coded plugins — PHP can absolutely run laps around other a decently coded site in other languages (at the cost of having to use PHP I guess ).
At Gnod, we are heavily invested in PHP. And it continues to look like that was a good choice.
What I would like to see discussed more is PHP's decision of not having an import system but to instead use a "namespace" directive in included files. This puts the burden of avoiding name conflicts on the included file rather then on the including file. While in Python and Javascript it is the other way round. Which in my experience makes things more logical and requires less tooling for an enjoyable coding experience.