If you had to learn programming all over again, what language would you pick to start with? There is a good chance your answer is not PHP. Who in their right minds is learning PHP these days, right?
In fact, PHP has slipped from 5th place in 2017 to 11th place in 2021 in Stack Overflow’s annual rankings of the most popular technologies used by developers.
Most educational programs at schools, colleges and online academies are now focusing on languages like Python. The reason is obvious – the syntax is easy to pick up and so you can get down to building and deploying applications right away.
However, stats such as this can sometimes create a skewed understanding of the programming landscape. Python and other languages are certainly gaining popularity, but that doesn’t mean PHP is dead. In fact, PHP continues to power over three quarters of all websites. So how is it relevant for today’s web/application scripting and programming needs?
Is PHP Still Popular?
To start with, let’s compare PHP to Python, its closest competitor. PHP and Python are both interpreted, object-oriented programming languages that can run on practically any underlying OS. They also have broad IDE support. While PHP is a scripting language more suited to web development programming, Python is a general, high-level programming language.
And one is exponentially ahead of the other in terms of popularity.
With nearly 5 million sites built on PHP, it leads the language pack across each and every website category, industry and geography. For teams building their tech stacks, this is an important distinction. “Popularity” means:
- There are more people in the market who understand that language. So, if you’re looking to expand your team, you find it easier to hire experienced programmers.
- There are more people working on various facets of the technology. This means, there are more (and better) solutions, faster bug fixes, more frameworks, bigger libraries, and an active community that can help accelerate your development lifecycle.
- There are more websites and web applications running on the technology. This would enable many plugins, add-ons and third-party tools to integrate with your app or site. With this, you can add more features without adding more hours to your project.
These are all great advantages to have in a programming language. But what makes PHP preferable from a business or operational point of view in 2022? Glad you asked!
The Pros of PHP
PHP offers an edge from every angle relevant to the product owner, the product manager, and the development team.
1. Development cost
Licensed frameworks and software are not inherently bad. They come with active communities and deployment support from the company that built them. But what if you have a mature team capable of adding every functionality you want and solving problems without getting stuck? That is where PHP and its open-source tech add value.
You can download, run and use it for free. So no matter how many users you have, how many websites you develop, or how frequently you plan to update them, your licensing and purchase costs will be close to zero.
You can use the additional cost savings to bring in more experts or buy proven third-party tools that add functionalities and deliver better ROI for your clients.
2. Flexibility
Being one of the oldest languages for web development also makes PHP special for two key reasons. One, it works with a wide range of plugins and has a rich library of functionalities. So if you can wireframe a website and enlist its features, there is a very good chance you can find relevant extensions and functionalities to execute the project.
Since PHP has been around for decades, there is barely anything that needs to be coded from scratch. For instance, to accelerate your development lifecycle without compromising performance, you can use readymade PHP scripts for specific functions such as booking and scheduling, ecommerce checkout, polls, listings, and so on. These work in a plug and play manner – just like those omnipresent but reliable and high-quality WordPress themes (WordPress itself is built on PHP). Such systems make it all the easier for new programmers or resource-thin teams to use PHP.
The same applies to PHP’s adaptability in terms of databases. The scripting language offers support for most databases of note, including MySQL, MongoDB and Oracle. The support makes it easy to connect your application with a database that works best with it. This can substantially impact developer productivity; coders can focus on actual app and service development instead of getting stuck in the integrations.
3. Learning curve
Python is regarded as one of the most accessible and easy-to-learn languages today. PHP stands on the same grounds. The official PHP documentation is comprehensive and covers a wide range of modules with detailed explanations of syntaxes. Add to that the mountains of tutorials that have accumulated across the web over the years.
PHP is easy to pick up even for young developers because the vast global community disseminates information. You can watch YouTube videos, pick up an eBook, or do a quick or self-paced online course to learn PHP and get to execution.
4. Upgrading and modernization
Many PHP jobs focus on upgrading, improving or maintaining legacy systems. This is viable even in 2022 because PHP is versatile across operating systems. For example, you can run it across Windows and its modern variants or use it on OSX or Linux.
If every web application or website starts using a different language for its modernization efforts, development costs will skyrocket. On the other hand, using the same scripting language for legacy website maintenance and updating means lesser code will be rewritten. This can control the development costs and incentivize website owners to update their websites.
5. Community
PHP is not the only open-source scripting language in the world with a rich community of developers and corporate sponsors. But… it is used by 90% of the top 100, top 1,000 and top 1,000,000 sites including Facebook and Wikipedia – two behemoths that couldn’t have differed more in their mode of content delivery.
Budding developers and website DIY-ers have so-called “drag and drop” options like Squarespace and Wix to build websites. But WordPress is the undisputed king of all CMSes. And PHP is obviously the language of choice for maintaining, developing and deploying WordPress plugins. As far as WordPress remains the preferred tool to build websites, PHP will be an active part of the ecosystem.
The Cons of PHP
Stack Overflow’s developer surveys consistently rank PHP among the most dreaded languages globally. Despite being open source, easy to use, and having an active community, devs simply don’t fancy it. If close to 90,000 professionals think so, there must be some issues.
Here are the most common gripes put up against PHP…
1. Inconsistent Function Names
One of the many reasons Python has been adopted worldwide is that the syntax is intuitive, and the function names are predictable. PHP is not that intuitive. Many of the function names are not readily anticipated. In addition, many developers do not appreciate the frequent referencing required for documentation.
2. Lacklustre Performance
PHP is more than 25 years old now, so it qualifies to being considered a “legacy” scripting language. Despite that, it’s only in its 8th major version at the moment. The slow pace of updates and the historically slow nature of the web have made PHP a bit lethargic in performance.
PHP famously restarts the entire application every time a web request starts – this is a nightmare if your application needs to share resources across requests. Again, if you need to segregate and manage your application’s installed language and library versions, there is no easy way to install multiple versions of PHP and switch between them quickly. You need to use containers which aren’t a great fit for every environment.
3. Bland Philosophy
One of the main reasons the debate around PHP gets heated is because its founder Rasmus Lerdorf doesn’t really care about coding. “I really don’t like programming. I built this tool to program less so that I could just reuse code,” he admitted.
But he didn’t stop there. “PHP is about as exciting as your toothbrush,” he declared.
Oops. #BrandingFail
Many developers take that philosophy at face value. If the founder is not a fan of programming and still plays a key role in keeping the language updated, how can PHP be reliable?
Many of these concerns are just speculations. Four fifths of the web can’t use a technology and be dissatisfied with it. Or can they?
The Future of PHP
PHP is here to stay. Until there are potatoes in mashed potatoes, there will be PHP on the web. The one thing that makes it a go-to tool for web development is, you can hire a couple of experienced developers off the bat and get on with your project.
With most concerns around security, performance, scalability and object oriented programming (OOP) addressed in the latest version, it is tough to see PHP falling out of any development team’s tech stack.