Why PHP Is More Hated and Popular Than Ever Before
Today's programming circus of engineering cliques forces us to bash any language that is contesting with the programming language you really like. Let's see why!
Join the DZone community and get the full member experience.Join For Free
Once again, I resist the accepted standards of pop culture to confirm what is happening in reality. But many readers of my writing will not want to hear me. Today I confirm that PHP is the illegitimate child of programming languages, and it is getting more and more popular every day!
What is the reason for the popularity? Why isn't this programming language dead already? Are you sure you can find something much “better” among the programming languages?
Well, you are wrong. If it really were, then they would have taken the lead and destroyed what PHP does years ago. Everyone should reconsider their priorities and think again about what a “better” language is.
If you’re still scratching your head, wondering why PHP is so popular and why it’s still not forgotten, then you probably don’t understand many things in programming. That has nothing to do with syntax, functions, or code.
It's Vogue to Bash PHP
Today's programming circus of engineering cliques forces us to bash any language that is contesting with the programming language you really like. So you can make a name for yourself. And this isn’t about functionality, but about the culture and more akin to religion.
Programmers are an arrogant and opinionated lot who prioritize criticism over programming languages they don't use. You can find programmers saying things like, “Go sucks. C # sucks. Java sucks. " They don't really care what the language is. The main task of the programmer is to criticize. There is also an opinion that between PHP and Python there’s an even deeper kind of disdain. This is a kind of war, where the primary goal is to assassinate PHP and replace it with Python.
Wikipedia has articles where the LAMP stack now includes Python. Seriously? About 20 years ago, I was using LAMP. But then the letter “P” in the LAMP acronym stood for PHP. Nobody said what this letter means, Python or even Perl. Maybe I'm being a conspiracy theorist for whom such changes are nonsense? I’m not excluding that the world is changing and things and definitions cannot change either. But it sounds more like the Python crowd is “culturally appropriating” our acronym.
For most programmers, Python is one area studied in college, along with a few other niche languages. Unfortunately or fortunately, most programmers never use them in their practice in the future. However, many of them have never written a single line of PHP professionally.
The very thought of someone writing PHP professionally can shock you, like people swarming to worship at the feet of the Antichrist. Actually, it is disdain for PHP is not really so much logical as it is communal and visceral. Agree, It’s “hip” to sip a cup of aromatic coffee at Starbucks with like-minded people or colleagues while dissing Nickelback, Trump, or PHP.
Now it comes down to the programming purists. They have wasted hours of their valuable existence nit-picking why PHP sucks so badly. Most of these arguments are the one Ring to rule them all. All this neglect and discussion revolves around pet preferences or nuances they don’t like. The result of all this is the opportunity to promote their own pet programming religion, sorry language!
But the real reason we as programmers like to bash PHP is a mix of our own, no small amount of thinly veiled jealously and inherent hubris.
PHP Is Easier To Use Than You Think
PHP has been around for decades. This programming language appeared long before many of you were born, in the mid-90s. I became familiar with PHP and started using it in the early 2000s. That's when PHP was transitioning from version 4 to 5. After a pleasant acquaintance, I started writing apps in ZendFramework, CodeIgniter, my own homegrown framework.
Why am I talking about PHP being around a long time ago? Because that's the main reason the language isn't going away. PHP is embedded, not just in new and legacy applications all over the world, but it's embedded in the people skills, both young and older, who have not abandoned the use of this language and continue to work with it for decades in a row. These people are not going anywhere and will continue to write the commercial code.
It's worth remembering the fact that Python has been around since 1991 before PHP ever saw the light of day. But that didn't make it that popular.
So why is that?
If I were comparing Python and PHP, I would describe the first language as a pain in the ass. This issue has changed somewhat with Python 3. But this improvement, which appeared not so long ago, all those fun “bells and whistles” (functions) PHP did out of the box. We had to install most of that functionality manually.
Another problem that hasn't been fixed in Python is its spaced syntax. There is nothing worse for me than writing code where the spacing determines delimiter syntax. I like to space my code the way I like and I don’t want my programming language impeding that. I don't care what you call me and what sugary words will frow in my face, but it's my goddamned code and I'll write it the way I want.
Python screams that its spaced syntax is “easily readable”. In fact, this is nothing more than marketing bullshit. Python uses the worst of opinionated syntax there is. There is no need to argue with this. I guess that developers just didn’t like to use it because the syntax was prone to introducing errors. Before IDE's corrected all that stuff, nobody else wanted to do this. And that is, or was rather, likely part of the reason why the language suffered from low adoption a decade or more ago. It just wasn’t all that user-friendly.
And, most likely, very few people knew it existed. It was embedded in Linux distributions as a scripting language. Probably because of this nobody used it or out screaming, “Ooh, Python, do you know that thanks to this language I can build a website?”
Unfortunately, many engineers did not take Python to do websites with really good features. They didn’t see the power of Python as being the best use for the web. But leaving my personal preferences about syntax aside, I can say with confidence that Python is a VERY powerful language functionally.
PHP is a Language Anyone Can Use
The thought never left me that Python could have overtaken PHP. Python has received so many updates over the past 15 years. But there is always a BUT. These updates were 10 years late, for sure. Python 3 released in 2008 broke backward compatibility. Python 2 code does not run with Python 3 unless you modify it. And one more thing. If you have a million lines of code that need to be updated, well, it won't work, especially not within an enterprise environment.
I'll be honest with you, PHP 7 & 8 also broke some PHP 5 (there is no PHP 6) code as well. I was fortunate enough to be part of the ZendFramework 1 team and work alongside those who update the framework to run on PHP 7 & 8. Fortunately, almost none of my enterprise legacy code broke when upgrading ZF1 to PHP 7 & 8. So, much of PHP 5.6 code is still very backward compatible.
But everything I said earlier did not affect PHP so much and pushed it into stardom, like perhaps the tiny startup company founded in 2005 called Automattic.
WordPress had humble open-source beginnings. This experience became a turning point and changed the way not just developers, but everyday people. Now we are all able to publish on the web.
Until WordPress started working, we couldn't choose something better than Joomla or Drupal, or some other BBS software. (There may have been other sites that just didn't get in my way.) But they were all a pain in the ass. This is because the developers of these sites were never thought of as real end-users. They did their job as programmers.
Had WordPress been written in Python, yea, PHP would possibly be on the downswing. But I dare say that Python would have stifled (if not wholly prevented) WordPress from achieving the meteoric rise it has enjoyed. If we are talking about open-source language, then now it is important to understand that adoption and extension contributor support is CRITICAL for the programming language to continue to develop.
As a university-trained software engineer, you can say whatever derogatory things you want about PHP, but it isn’t only being used by pedigreed software engineers. It is a popular language that moonlighters, entrepreneurs, graphic designers, grade school kids, housewives, corporate managers will use with their very first computers writing web pages. Hundreds of millions of them.
I say with confidence that PHP is the BASIC (language) of the Information Age.
A software engineer will never think like a consumer. He will not put himself on someone who just wants to get a website up for their small business. Will not boom as a person with limited resources and time to do it.
WordPress and PHP Changed All of That
Yes, WordPress by itself was easy to use. Although some important things were missing here. For example, WordPress' plugin architecture (I find it easy to use the term “architecture” here). It is this aspect that enables any user to write tiny little pieces of code in PHP. That being said, it doesn't need to rewrite entire classes or become software engineers to get stuff done.
The easy-to-understand PHP language allows everyday people to write code that works. Thanks to this, everything can be done much faster and easier. It's un-opinionated. No compiling. It's loosely typed. It works well.
PHP Runs the Worldwide Web
It has been 15 years since PHP appeared. Today this programming language powers 78% of the Web. WordPress alone accounts for nearly 40% of all websites and has nearly 2/3 of the CMS market share! Yes, Python would like to have 10% of these markets! But given that Python accounts for less than 1.5% of the Web, it’s foolish to keep saying all your hate toward PHP.
And this is as it should be.
Wait. WHAT ?!
I was recently contacted by recruiters with corporate clients. The first thing they asked to do was rip out all of their Python web code and replace it with PHP. For many, such statements may be shocking. But I assure you, I come across such wishes quite often. Why? Because honestly, the web is not the best use for Python code. Python people tend to be data science and other specialists. There is a shortage of specialists, a shortage.
Companies often don’t have time to search for weeks or months to find a new Python person. Python engineers are very expensive. Small-business to enterprise-class PHP programmers are much, much easier to source and even train. Finding the Python version is a tricky task. Therefore, many companies are content with a seasoned, senior-level PHP architect with decades of experience.
The point is, if you’re working for a company and writing their web or middleware in Python, you’re saddling that company with code that will cost them a lot of money. An application architect is a person who should analyze the work of a business and select the most efficient technology for their use case. Here you have to swallow your dislike for one of the programming languages, shove the hate up your ass and do what will be really effective.
There are very few use cases where I would recommend writing a SaaS app wholly in Python. Plus, I know many programmers who would do the same. They've used Python where it shines. Or vice versa, they replaced it with PHP, because this language will be the best.
People are arranged the same way to like to use what we know and pooh-pooh anything we don’t. Programmers are no exception to this axiom.
Universities and colleges taught us to think of Python as a general-purpose commercial language. In fact, this is far from correct. Correctly present Python as a high-end language for running data science, servers, crunching big complex numbers. This language is suitable for mining crypto and it does all this very well.
PHP is the language of the Worldwide Web, the language of the masses.
Even if you keep slamming PHP as an illegitimate child of languages or you put aside that opinion, you can't change the fact that PHP is BY FAR the most widely used language on the web. If you look again at the continued meteoric growth of WordPress and the new speed of PHP 7 and PHP 8, you will have no doubt that that stature is there to stay.
Opinions expressed by DZone contributors are their own.