The sad thing is that nothing else has come along to fill the niche that PHP fills. Here are the key advantages of a PHP like language:
1. Low barrier to entry. An HTML document is pretty much a valid PHP program. You can add as much or as little code execution as you want to it. While at a certain point you should probably use templating (to handle things like escaping automatically, etc) but a low barrier to entry really helps get people on.
2. PHP has a stateless functional core. All the system functions are part of the web server binary. There's no loading some giant object tree just to print something to the screen. This is huge because of...
3. Resource management for serving HTTP requests is, to me, basically ideal in that you create a bunch of stuff, spit out a result and then tear everything down. It's hard to leak resources this way. No garbage collection oddities to deal with. The Java equivalent to this was the servlets API (years ago) but it doesn't share the same issues;
4. No multithreading on a per-request basis so you don't have to deal with race conditions at all in user code;
5. An opcode cache sufficiently closes the gap on code performance in the vast majority of cases at little to no cost to the end developer; and
6. Typically you can just hit reload on your browser and immediately find out if something works. That's really nice.
Big things missing from PHP:
1. A good type system. I use Hack at work (Facebook) and this solves a lot of problems; and
2. Cooperative multitasking via async/await semantics (again, Hack has this).
I'm a big fan of PHP not making breaking changes (badly) like Python did. You can't fix the inconsistent argument ordering in standard functions ("is it needle, haystack or haystack, needle?") but it basically doesn't matter at this point. I use an IDE that tells me the correct order anyway so who really cares? The way to handle that is to create new versions that are consistent.
Hack has these collections: vec, keyset and dict. These essentially replace array (side note: PHP maintaining insertion order on array is such a hugely useful feature). They have a consistent set of library functions (in C\, Vec\, Keyset\ and Dict\).
One other thing that I found hugely useful when I first did PHP was preg_replace_callback. I found this so useful that when I did Java after that I basically write a version of this function.
So anyway, there are a ton of legacy problems with PHP but nothing else has that same set of desirable characteristics IMHO and I really wonder why not.
1. Low barrier to entry. An HTML document is pretty much a valid PHP program. You can add as much or as little code execution as you want to it. While at a certain point you should probably use templating (to handle things like escaping automatically, etc) but a low barrier to entry really helps get people on.
2. PHP has a stateless functional core. All the system functions are part of the web server binary. There's no loading some giant object tree just to print something to the screen. This is huge because of...
3. Resource management for serving HTTP requests is, to me, basically ideal in that you create a bunch of stuff, spit out a result and then tear everything down. It's hard to leak resources this way. No garbage collection oddities to deal with. The Java equivalent to this was the servlets API (years ago) but it doesn't share the same issues;
4. No multithreading on a per-request basis so you don't have to deal with race conditions at all in user code;
5. An opcode cache sufficiently closes the gap on code performance in the vast majority of cases at little to no cost to the end developer; and
6. Typically you can just hit reload on your browser and immediately find out if something works. That's really nice.
Big things missing from PHP:
1. A good type system. I use Hack at work (Facebook) and this solves a lot of problems; and
2. Cooperative multitasking via async/await semantics (again, Hack has this).
I'm a big fan of PHP not making breaking changes (badly) like Python did. You can't fix the inconsistent argument ordering in standard functions ("is it needle, haystack or haystack, needle?") but it basically doesn't matter at this point. I use an IDE that tells me the correct order anyway so who really cares? The way to handle that is to create new versions that are consistent.
Hack has these collections: vec, keyset and dict. These essentially replace array (side note: PHP maintaining insertion order on array is such a hugely useful feature). They have a consistent set of library functions (in C\, Vec\, Keyset\ and Dict\).
One other thing that I found hugely useful when I first did PHP was preg_replace_callback. I found this so useful that when I did Java after that I basically write a version of this function.
So anyway, there are a ton of legacy problems with PHP but nothing else has that same set of desirable characteristics IMHO and I really wonder why not.