DEV Community

Jigar Shah
Jigar Shah

Posted on

Who Needs PHP Anymore?

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 has no competition.

Image description
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. Even C++, Java and Ruby fare better, according to a Stack Overflow survey. And it’s the butt of frequent jokes in the community.

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. Even C++, Java and Ruby fare better, according to a Stack Overflow survey. And it’s the butt of frequent jokes in the community.

So why did PHP lose its popularity over the years? What are the challenges, pros and cons in using PHP to build websites? Is it relevant to today’s web? Will it remain relevant tomorrow? Let’s attempt to 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 large a 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:

Image description
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 is known to have 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 8th 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.

Then there is JavaScript. While it’s a client-side scripting language (and so, an apples-to-oranges comparison with PHP), the rise of Node.js and other frameworks for JavaScript facilitates server-side scripting as well as full-stack development, which PHP doesn’t. JavaScript fuels single-page applications such as Google Drive, where the page is re-rendered at lightning speed using data from API calls, eliminating browser refreshes. This would be pretty hard to replicate using PHP.

So what’s keeping PHP alive and kicking?

What’s Right with PHP?

PHP has many great things going for it – apart from the gigantic installed base.
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.
Huge community
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.
Extendibility
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 readymade, 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.
Database connectivity
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.
Versatility
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.

The Verdict
To answer the question in the title, this article is delivered to you by a website that’s built on PHP. So even if you’ve even skimmed up to here, you can deliver the verdict yourself!

Image description

Top comments (4)

Collapse
 
moopet profile image
Ben Sinclair

I'm not really sure about some of your points. Other languages have mature database connectors. PHP is almost exclusively used with MySQL, and while PDO lets it connect to a lot of RDBMS, it usually doesn't work that way. Your Wordpress example stat, for instance, will be 99.99% MySQL.

Most languages are platform-independent. There are only a few edge-cases where you need to run on a particular OS, and those are languages designed specifically for that OS. Most languages are free software, or at least open-source.

I don't think these points are arguments in favour of any particular language.

Collapse
 
shshank profile image
Shshank

I totally agree with you.

Collapse
 
gilbertogalea_96 profile image
gilberto-galea

Clearly this is a marketing issue point. If you need to target on the top, you need first put down the number one. I wrote PHP programs using Oracle database, and worked well, there're many tools to connect with many other DB like firebird (Borland) or MongoDB (used and tested by myself). I like a lot PHP, and recently noted most of new trends No code, Low code, the sites offer them really using inside, versions of Laravel(PHP) like base before show the UI to clients. Long live to PHP.

Collapse
 
kolja profile image
Kolja

Sadly new tools like Strapi or Supabase running on Nodejs and there are no alternatives in PHP.