If you’re pressed for time, we’ve prepared a TL;DR version for you.
Here are the key takeaways from our article:
If you wish to learn how we’ve reached those conclusions—keep reading!
We’ll start with a little background, useful in understanding the popularity of PHP and Python. How did the two languages join the ranks of the most prominent tools for web development? Where did they used to be and where are they now?
PHP is often called a “scripting language for the web,” but in reality it can be used for other purposes, as well. This definition, however, does give us a hint about the origins of PHP, because the language was indeed created with the web in mind.
The first version was a set of scripts written in the general-purpose scripting language C. Rasmus Lerdorf, the creator of PHP, named it the “Personal Home Page Tools.” He wrote the scripts in 1994 to track visits to his online résumé. It wasn’t until 1998 that PHP became a real programming language.
PHP then kept on growing in popularity, and in 2011, the PHP development team created a timeline for releasing new versions. With it came the requirement that every version should have at least two years of support in terms of security and bug fixes, with at least another year of security fixes.
This assumption is both good and bad. Support is always welcome, but two years is not a lot of time. In long-term projects, this means higher costs of maintaining the codebase and keeping the product up to date.
The latest version of PHP is PHP 7. It’s used by 38.7% of all websites that use PHP.
Conversely, 60.8% of websites using PHP still use version 5.6 or older, none of which are supported by the PHP development team anymore. Teams from other companies, like Debian, continue supporting the older versions, though.
A wide variety of websites use PHP. One of the brightest stars in PHP’s portfolio, so to speak, is Wordpress. All the data on the biggest blogging platform in the world is moved around and managed by systems written in PHP.
But it’s not just the Wordpress development team that’s fond of PHP. The language also serves as the engine behind:
On top of that, PHP is used by 42,260 other companies, according to Stackshare. The actual number of companies that use it is surely even higher than that.
PHP is used on as much as 80% of all web servers. Yes, you read that right: PHP crushes every other language in terms of popularity in server-side scripting.
Just take a look:
There are several reasons why PHP is so grossly popular on the server side of the web:
All of the above—the history and the popularity—makes PHP a stable, mature technology that is continuously improved thanks to the efforts of its development team and the legions of developers who use it.
The first version of Python was released in 1991 by Guido van Rossum. Until July 2018, van Rossum also held the title of the “Benevolent Dictator for Life” of the Python language. This meant that any and all decisions and changes regarding Python had to be approved by him.
It isn’t really relevant to this article—but it’s too cool not to mention.
While PHP grew from a simple web development tool into a general-purpose programming language—through development that has always been somewhat scattered across different teams and companies—Python is a completely different kind of beast. For 28 years, the development of Python was closely overseen by its creator, who remains a part of the team to this day, just more on the sidelines.
Python was a general-purpose programming language from the start, written to substitute a language called ABC. After version 2.0 was released in 2000, 2.1 and all the versions that followed were built under the Python foundation.
The latest major version of Python is Python 3—with 3.7 being the most recent stable release—currently used by 34.6% of all websites with Python on the server side. 65.4% of Python projects still use version 2, which is going to lose support on January 1, 2020.
Python 2 losing support isn’t too much of a problem if you’re building a new Python application from scratch. However, for teams who have been using version 2 for a long time, things may get dicey. Head over to this article to learn why exactly you should migrate from Python 2 to Python 3. Once you’re convinced it’s a good idea but unsure where to start, here’s a comprehensive guide to help you on your way.
We’d rather not discuss Python 3 migration any further now. Instead, let’s focus on the purpose and common applications of Python.
The chief focus of Python was never web development. However, a few years ago, software engineers realized the potential Python held for this particular purpose and the language experienced a massive surge in popularity.
As of 2019, Python respectively holds the 3rd and 1st places in the TIOBE and PyPL programming language popularity rankings—outranking PHP by several positions.
Python is easy to learn, though hard to master. Because of this, many colleges around the world use it to teach software development and data science. The language enables students and researchers to write simple scripts for complex computational tasks—and that’s just the tip of the iceberg.
The applications of Python are numerous:
There’s virtually no end to what Python can do for you and your software project—you just need to know where to look.
The language is used on the server side of 1.2% of all websites. Compared to PHP, that number may seem small, but it’s still a significant portion of the web. This is quite understandable when you consider that web development isn’t the main purpose of Python.
Regardless, Python powers 5,839 digital companies (according to StackShare), including tech giants like:
Just imagine: the language researchers use to write scripts for scraping data is also the same language that makes it possible for you to watch Stranger Things on Netflix, post selfies on Instagram, or get an Uber ride home after a night out with friends.
To quote our beloved Sith Lord:
Choosing the right technology is only one part of the equation. There is another all-important issue you need to answer: how easy will it be for you to find skilled developers using your technology of choice? Let’s analyze the data.
In their 2019 survey of almost 90,000 software developers worldwide, Stack Overflow found that 39.4% of developers use Python. In the case of PHP, the percentage is 25.8. Those figures alone, though, don’t tell us how many developers there are on the market.
Luckily, ZDNet provides a rundown of relevant estimated data. According to them, there are 8.2 million Python developers, most of whom work on ML and IoT apps.
For PHP, there are 5.9 million developers, mostly working on the web and cloud.
Clearly, finding Python developers should be much easier, simply because there are more of them, right?
Consider the most popular use case at the moment: web development. PHP is more widely used in this area than any other server-side technology, and has been in use longer than Python. Therefore, it would stand to reason that it’s actually easier to find PHP web developers.
A short search on Freelancer confirms this. For the keyword “web developer,” filtered by Python, it shows 5,388 freelancers. The same keyword filtered by PHP? 8,982 freelancers.
However, we also need to take into account the types of projects PHP developers are hired for the most. In the current landscape, it often isn’t building new projects.
Remember: 80% of web servers currently use PHP. Those need maintaining, bug fixes, new features, and a lot of them might also need upgrading to version 7. Many PHP developers are Wordpress developers, so they’re very well equipped to handle such tasks.
Finding PHP developers for maintaining the old web won’t be a problem. Finding web developers to build new products in PHP? That’s a different story.
Python developers, on the other hand, are better equipped for the future of the web, powered by artificial intelligence and machine learning, and connected with the Internet of Things. They are also well versed in things like data scraping and data science on the largest datasets, a.k.a. big data.
As such, it’s really easy to find Python developers for web development jobs related to machine learning, as well as building complex, innovative products for the web.
Let’s tackle the most important question at the heart of this article: when should you go with PHP and when should you go with Python for your software project?
If you tried hard enough, you would be able to build the same web application using either technology, and both would seem identical from the user’s perspective.
Python and PHP both have frameworks for web development that make this possible. The top 2 Python frameworks are Django and Flask—head over here to see how they compare to one another—while the most popular PHP framework is Laravel.
This list is by no means exhaustive, but it does show that there are prominent tools for web development for both languages.
With that out of the way, let us now ask ourselves: what types of projects are Python and PHP good for?
But the applications of Python go far beyond web development. Python is great for innovative projects utilizing artificial intelligence, machine learning, and data science. It allows you to create new types of digital services or offer standard services done in a brand-new way.
PHP was always intended for the web, and it’s the foundation of many established internet giants, like Facebook or Wordpress.
The applications of PHP lie more on the side of legacy software. The language can be found all over the web and isn’t going anywhere, so somebody has to maintain all its use cases. However, PHP is decidedly not the weapon of choice most programmers today would use to build innovative web applications.
All in all, PHP is great for what we could call “traditional” web projects: content, social platforms, blogs. Essentially, projects that don’t require immense amounts of calculations or bleeding-edge features.
We’ve taken a broad look at both technologies: key facts from their development, insights into their purpose, and their popularity.
So, how are Python and PHP similar, and how are they different?
Both Python and PHP score very high in terms of:
Despite the differences in their common applications, PHP and Python both rank high among the most mature, secure, and popular technologies that form the fundamental building blocks of the complex mosaic that is the IT industry.
If we compare the fact that 80% of all websites have PHP on the backend, and only 1.2% are built with Python, it might seem that Python loses the popularity race by a wide margin. But when you consider the variety of applications of Python, and not just for web development, then it’s really nip and tuck between these two technologies when it comes to popularity.
Python has the Python Software Foundation, whereas PHP has several different teams supporting and developing different versions of it. At the same time, both languages have an army of open-source contributors.
If your focus is web development, then both technologies will serve you well, since each has powerful web frameworks that simplify and speed up their development of web applications.
Based on this rundown, it would appear that Python and PHP have quite a bit in common. However, in a closer, side-by-side comparison of pros and cons, certain key differences emerge. Depending on your project, those could be seen as either strengths or weaknesses.
Scientific calculations, powerful web apps, machine learning models, complex big data management—Python can do it all. It’s a clear winner in terms of versatility.
Organized and structured
The development of Python was historically more structured than PHP’s, so there are fewer versions of Python that boast better support, making maintenance and security easier.
On the rise
Python’s popularity has skyrocketed in recent years, due to its powerful applications in the fields of AI, ML, and IoT.
Since Python is an open-source language, anyone can contribute to it and create their own library. Although this aspect is essentially positive, it also means that the quality of some of the libraries and their documentation is not up to scratch. Unlike PHP, the organization of Python libraries also leaves a lot to be desired. Oftentimes, there are discrepancies between Anaconda and PyPi, the two main Python package managers.
PHP is the single most popular server-side technology on the web, so its current development is aimed toward maximizing the language’s usability in this aspect.
The development of PHP is strewn across multiple parties, with several versions developed by different teams, which can be troublesome.
There’s no denying that the newest version of PHP is powerful and the language isn’t going away anytime soon. But the technology’s overall popularity has stalled, and it’s considered a legacy technology pretty much across the board nowadays.
Truth be told, if the software product you want to create is a company website, a blog, or a simple web service, you’ll be equally well-off if you build it in PHP, Python, Ruby on Rails, or any other prominent web development technology. Your end users won’t be able to tell the difference.
Your decision should really depend entirely on two factors:
That is why the planning stage of software projects truly is the most crucial part.
If you have any questions or doubts about the technology you should use, contact us anytime! We’re big fans of Python at STX Next, but we’ll gladly send you to one of our partners who specializes in a different technology if we decide that Python isn’t the best choice for your software project.