3 ms·
Fundamentally, PHP has an entirely separate address space for each web request... This is a much more "robust" (reliable as opposed to "featureful") approach
by terra_t 16y ago
Fundamentally, PHP has an entirely separate address space for each web request... This is a much more "robust" (reliable as opposed to "featureful") approach to web development because there are no data structures in RAM that are shared concurrently between requests.
For example, in ASP.NET, I've had a whole team of developers swear up and down that there are no static variables in a particular segment of code that could be the subject of a race condition. Sure enough, I go in there and find one that's hidden away in a very obscure location.
Java has the same problem, as does any environment that exposes threads to the language. Sure, in theory you could do some very nice things by sharing data structures between requests, but practically the whole programming style of PHP encourages people to avoid horrible horrible problems with concurrency, and there are no language features, even in the laboratory that practically make those problems go away.
To take another example, the urldecode function in CPAN has been wrong for 15 years. If you want to write a urldecode that works right, you've got to write your own (possibly using the built-in for a base). Similarly, the URI object in .NET sometimes does incorrect transformations on URIs, and you need to use string URIs if you want to make interoperable semweb systems... PHP has the lowest fraction of 'things that say they work but really don't work' of any web programming languages, and that's the reason why it is so successful. Other languages are "blub" because they don't recognize that it's even possible for things to be this easy.