This content originally appeared on DEV Community and was authored by neoan
It seems to be common knowledge that PHP is a terrible language and that it's not enough to simply avoid it, but to signal your position with memes to make sure you are "a full member of the web dev world". But what is behind this weird behavior?
The history
When PHP gained popularity in the late 90s, it wasn't perceived as a full programming language. Back then, the acronym stood for "Personal HomePage" Tools and was more like a capable template engine than anything else. Additionally, the concept of a "web language" was more or less unknown: something that only does this new internet thingy? How can we take that seriously? With this background, the first wave of "PHP hate" came from programmers that saw PHP as a cute yet inconsistent tool for hobbyists. And arguments pointing out structural weaknesses were usually founded and mostly based on comparison to compiled languages. End of story? Not so fast!
Wave 2
Further development and the rise of Content Management Systems like TYPO3, WordPress, Yoomla & Co in combination with efforts by Zend & Symphony while the internet exceeded all expectations have transformed PHP into a widely used stable companion without competition (Well, ignoring Perl, that is). Wikipedia and Facebook are just examples of the big players of this era using it in a completely different way than the original intention. However, there were still missing features, security concerns and a standard library that "classical programmers" disliked for consistency reasons. At that time it was clear, however, that another wild-card has grown from enhancing the UI with little gimmicks to something that wants to be taken seriously: JavaScript. And for reasons I will not expand in in this post, JavaScript was seen as the worst nightmare of them all with a problem that in theory exists to this day: every browser treats your code differently. It was worse than that. Whatever inconsistency or unusual behavior PHP might have had, JavaScript doubled down on it and made sure that books can be filled with quirks and their explanations to this day.
In this scenario and with PHP codebases like Wordpress and Magento ruling the web with disregard to non-existent best practices, the web was a playground for explorers and adventurers. So why not Java? Why didn't a language that honored features that modern PHP or Typescript made possible over a decade later from the get-go rule the web? Well, it's speculation, but I believe it's a mixture of the web first being a hobby culture in combination with the hope that more predictable and capable technologies than HTML, CSS and JavaScript would run on browsers. But that never happened. See, the only reason we don't say things like "CSS is the worst styling option" is due to lack of alternatives. On the backend, however, that wasn't the case. Java, C# & Co offered viable alternatives to PHP and - with the rise of web frameworks - user friendly alternatives. This led to PHP having to evolve in order to compete with these "serious" languages, while jQuery was "enough" to keep the front-end interactive.
The 5.6 stalemate
PHP rapidly evolved until version 5.6. At that point, further development had to be leveled against a huge problem: backward compatibility. With the fast majority of the web running on LAMP (Linux, Apache, MySQL, PHP), one couldn't risk to potentially "break the web". As a result, PHP6 never came to be, leading companies like Facebook to create their own spinoff and others to go a completely different route. So in wave 2, we still have criticism of PHP that is mostly based on real arguments by programmers who either wrote low-level code or used structurally superior alternatives. However, we are now in the middle of the 2010s, a new kind of critics came from an unexpected direction: JavaScript developers. With NodeJS on the rise, a new generation of JavaScript only developers started to bash PHP in order to present an approach that had no technical advantage, but would simplify and revolutionize the web in combination with somewhat predictable and stable front-end solutions like AngularJS. Additionally, NoSQL databases made data persistency for the ones "overwhelmed" with relational solutions reachable.
Wave 3 / status quo
So were are we now? PHP8 has grown into the fastest interpreted language with all features one could desire without transpiling or compiling and without the dependency-hell and installation time of i.e. node. However, every week we find a new "PHP go home" meme on our wall and beginners are actively discouraged of giving it even a glance. These beginners have grown into mid-level, sometime senior developers without ever having given PHP a look yet tweeting about the superiority of "their" solution as if it was grounded on anything else but the generation before them preventing them from making up their own mind.
Why should you care?
In a time were serverless devs consider themselves as full-stack and bootcamps selling the idea of being a reputable developer after 14 weeks, we live in a world where express developers are under the illusion that they are using a superior technology and therefore have the "right" to look down on PHP. And not only is that far from the truth, but it also makes them look really stupid or at least uneducated. Whenever I encounter a candidate or student laughing at or bashing at PHP, I always ask if they can explain their distaste. And the answers are always embarrassing and only show their limited understanding of technology in general.
This content originally appeared on DEV Community and was authored by neoan
neoan | Sciencx (2021-06-07T14:43:56+00:00) Why bashing PHP makes you look stupid. Retrieved from https://www.scien.cx/2021/06/07/why-bashing-php-makes-you-look-stupid/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.