For software developers, comparing programming languages is like comparing apples and oranges. Skilled programmers have their favorite tools of the trade, strong opinions, and personal preferences.
But for project managers, this is a valid concern. Choosing your technology base wisely can have a big impact on the way you manage the development process of your web application.
Will you be able to hire new developers quickly if necessary? Is one technology more future-proof than another? Which popular companies use which languages? What kinds of products can you build with each technology? Which has better long-term support?
Those are all important questions. This article will answer them for you.
In the past, we discussed how Python stacks up against other programming languages, such as Go, Java, or Node.js. Now, it’s time to compare Python to the dark horse of web development: PHP.
PHP vs. Python: Summary
Here are the key takeaways from our article:
PHP was web-focused from the start and currently powers ~80% of website servers because it’s the default web server technology. Because of that, PHP is a bit of a legacy technology. This means it’s easier to find PHP developers for maintenance, refreshing websites, adding new features, or migrating from outdated versions. Though PHP boasts powerful web frameworks, it’s a technology best suited for traditional web projects: providing content and blogs with limited complexity or computation. Python, on the other hand, was a general-purpose scripting language with a scientific background from the start. Common applications of Python include college-level programming education, writing scripts for data scraping and computations, managing complex big data models, as well as artificial intelligence, machine learning, and the Internet of Things. Python has skyrocketed in popularity over the last few years and offers multiple web development frameworks perfectly suited to the needs of different developers. This wealth of Python tools enables fast MVP building and simplifies the development process of web apps. Writing simple applications in Python is effortless, though the language works best in web development for building complex applications that perform a lot of computations. Python is also great for software products that use AI/ML to provide either new types of services or traditional services in a new way.
A brief (hi)story of PHP: Facts, figures, and use cases
1. PHP: Essential information and milestones from 1994 to 2019
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.
2. What is PHP used for?
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.
3. Popularity of PHP
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.
There are several reasons why PHP is so grossly popular on the server side of the web:
- it was built and released long before most of the other viable web server development technologies used today;
- the language lies at the heart of several content management systems—Wordpress, Drupal, Joomla—so it powers all the websites built on those systems;
- every web hosting server has PHP installed.
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.
A brief (hi)story of Python: Facts, figures, and use cases
1. Python: Essential information and milestones from 1991 to 2019
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.
2. What is Python used for?
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:
- web development;
- scientific and numeric computing in mathematics, science, and engineering;
- teaching the fundamental concepts of programming;
- build control and management, testing, and other types of support in software development;
- building enterprise and ecommerce systems.
There’s virtually no end to what Python can do for you and your software project—you just need to know where to look.
3. Popularity of Python
Python is the leading technology in the fields of artificial intelligence, machine learning, statistics, system testing, scripting, and—as of the past few years—web development.
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.
Programmer availability: Are Python or PHP developers easy to find?
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.
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.
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.
Should you choose PHP or Python for your next web development project?
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.
1. Python and PHP web development frameworks
- Yii 2
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?
2. What is Python good for?
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.
3. What is PHP good for?
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.
Advantages and disadvantages of Python and PHP
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?
1. Differences and similarities between PHP and Python
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.
2. Comparing the pros and cons of Python and PHP
a) Pros and cons of Python
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.
- Messy libraries
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.
b) Pros and cons of PHP
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.
Final thought on PHP vs. Python
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:
- the individual requirements of your software project,
- the skill set of your development team.
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.
And if you’d like to learn more about Python, contact us