3 ms·
Several reasons, I think. For one, it's no secret that PHP was an amateur undertaking that inadvertently ended up powering >80% of the web. It started off as
by vezzy-fnord 13y ago
Several reasons, I think.
For one, it's no secret that PHP was an amateur undertaking that inadvertently ended up powering >80% of the web.
It started off as a bunch of helper functions that were meant for Rasmus Lerdorf's personal use. He has frequently acknowledged that he was never particularly skilled and that PHP was never meant to be used on such a large scale. Among the countless WTF moments you would expect from a personal project, PHP once used strlen() as a hashing function. [1]
Thus, PHP ended up having a very inconsistent design and an awful typing system. It ended up becoming quite baroque, it has never had a formal specification and it has no coherent idea of what it wants to be. This is exemplified by PHP's relatively recent appropriation of Java idioms in an attempt to bring vague Nygaard OOP.
Third, it's fundamentally a templating language and it doesn't encourage any cohesive design patterns or practice. Most PHP sites don't even use frameworks, but rather go with the Mozart (or rather, spaghetti) style of copy-paste programming. There is no clear separation of concerns.
Fourth, the PHP community has always been dominated by amateurs. I can't really direct you to any objective statistics, but in general PHP has a disproportionately high amount of leechers and newbies, largely because it has been so deeply ingrained into the public consciousness as the de facto language of the web, without knowing of the better designed general-purpose alternatives.
Fifth, some concrete examples of PHP's horrific internals. [2] [3] [4]
Alternatives? Anything, really. Python, Ruby, Perl, Common Lisp, Haskell... whatever floats your boat. A minimal web framework is a trivial application to write. That's why there's so fucking many of the goddamned things.
[1] http://news.php.net/php.internals/70691 http://news.php.net/php.internals/70691
[2] http://www.phpwtf.org/ http://www.phpwtf.org/
[3] http://www.phpsadness.com/ http://www.phpsadness.com/
[4] http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... (the famous article)