PHP is the mainstay of the world wide web today. Over three quarters of all the sites in the world are powered by PHP at the moment. When it comes to server-side programming languages, PHP—Hypertext Preprocessor, for those who came in late—has no competition.
And yet, there are significant undercurrents in the developer community against PHP. PHP is the most hated mainstream programming language after the obvious culprits such as C, Perl, Assembly and VBA—probably due to the perception that it’s a clunky and old language compared to more modern ones such as Python. Even C++, Java and Ruby fare better, according to a Stack Overflow survey. And it’s the butt of frequent jokes in the community.
when you're reminded you wrote the world's biggest social network in PHP pic.twitter.com/bnXqNeDjiC
— I Am Devloper (@iamdevloper) April 11, 2018
So why did PHP lose its popularity over the years, despite having a strong installed base?
We already know it’s the mainstay of today’s web. However, will it remain so tomorrow? It is standing its ground amidst a barrage of new technology and scripting languages—both old and new. Let’s examine the challenges, pros and cons in using PHP to build websites while we answer these questions.
The Reality of the Web is Interwoven with that of PHP
Even if all developers and webmasters resolved to stop using PHP today, they couldn’t because WordPress, the most common and most popular content management system (CMS) on the internet, is written on PHP. A staggering 43% of sites today run WordPress—and the number is only slated to increase, as per data from W3Techs.
But you may be forgiven for thinking that PHP is used primarily as a base for CMS. A technology so deeply entrenched and with such a large community cannot live or die on the back of one application. Here’s what over 600 development teams all over the world are using PHP for at the moment, according to the Zend PHP Landscape report:
So what’s the problem? Why are we even talking about the need for or future of PHP?
What’s Wrong with PHP?
PHP was never intended to be a widely used programming language. The man who created PHP in 1995—Rasmus Lerdorf—is known for bashing his creation as well as his own programming skills. “I really don’t like programming. I built PHP to program less so that I could just reuse code,” Lerdorf reportedly said.
In an interview with SitePoint, he went one step further in belittling PHP. “PHP is about as exciting as your toothbrush. Who would want to read about toothbrushes?”
Given the unintuitive, unremarkable and inconsistent nature of PHP’s syntax as well as the poor design principles it is built on, many developers agree with Lerdorf in principle. Even though PHP is a whole 27 years old, it’s only in its eighth major version. The pace of updates and incremental updates to the core is painstakingly slow and erratic.
Speaking of unintuitive and unremarkable, there is the question of the alternatives and comparable languages.
The closest competitor—in terms of perceived and visible popularity—is Python, which developers love for its simplicity and flexibility. Python is a server-side language like PHP but it’s designed in a way that developers need to write a lot less code. While barely a fraction of websites run on Python today, it has emerged as the #1 choice for AI and ML programming as well as anything related to big data.
So what’s keeping PHP alive and kicking?
What’s Right with PHP?
PHP has many great things going for it, not least the sheer number of websites it powers.
Tried and tested code
An undeniable advantage of PHP is that every imaginable function has been written, shipped and used over the past 27 years. There is barely anything you can’t make a PHP-based website do. Developers can rest easy knowing that any issue that comes to the fore has been (or will be eventually) faced and resolved.
While the latest breed of developers has come to hate it, veteran developers have built entire careers on PHP. They’ve put a ton of tips, tutorials and FAQs out there that answers pretty much any question even an experienced developer can have.
This is a good thing for businesses and organizations too—if you’re looking to build a website or web application, you have a huge pool of skilled and knowledgeable developers to choose from.
Given its long history and community of expert developers, PHP has amassed a massive library of functionalities, plugins, frameworks and so on over the years. There’s hardly anything that you might need to code from scratch. PHP frameworks such as Laravel, CodeIgniter and Yii speed up and standardize development on top of ready-made, generic functionality.
Further, there are also a ton of sites that provide readymade PHP scripts for niche-specific functionality like ecommerce carts, listings, polls, calendar booking, etc. that allow you to accelerate the application development life cycle without foregoing performance.
The biggest advantage PHP has over competing languages like Python is its database connectivity. PHP connects securely and easily with almost any kind of database, giving developers the leeway to choose from a wide variety of database programs available today. It also serves to improve their productivity by focusing on app and service development rather than database integrations.
PHP is free and open source in every sense of the terms, unlike other programming languages, applications and operating systems. This means PHP has a vast number of developers constantly providing support, implementing cutting-edge features, fixing bugs and vulnerabilities, and adding new components.
PHP comes pre-installed on web servers in the form of a “LAMP” box (Linux, Apache MySQL, PHP). And yet, it’s platform-independent—you can run it on Windows, Mac OS or Linux. What’s more, it supports every browser you’ve probably heard of.
To answer the question in the title, this article is delivered to you by a website that’s built on PHP. That makes the verdict pretty clear, if you ask me!
Yes, PHP is losing popularity—it ranks 10th on the list of most popular programming, scripting and markup languages in Stack Overflow’s latest developer survey. PHP developers are also the second lowest paid among their peers.
And yet, PHP is the language that SHOWS UP in the survey year after year. And therein lies its strength. Newbie developers can safely bet that PHP will be around—and Stack Overflow will be including it in its surveys—10 years from now.
Over the last two decades, developers have never stopped building sites in PHP while constantly improving its open source codebase. PHP has withstood the test of time—and outlasted numerous web technologies during its 20-year reign at the heart of the internet. If you ask me, it’s not going anywhere anytime soon.