Summary: There’s fierce competition between PHP and Python in web application development. Can’t decide which one you should use among PHP vs. Python? Check out this detailed guide.
In today’s highly disruptive technology world and ever-evolving web development solutions, PHP and Python are the most popular server-side languages most businesses prefer. However, choosing a side in the “PHP vs. Python” debate isn’t easy. While many websites are programmed in PHP, Python has seen a steep upward trend over the past two years.
If you’re wondering whether Python development suits your project or if you should stick to PHP, you’ve come to the right place.
We’ll open the post with some basics about the two languages. Then, we’ll proceed to the comparison, in which we’ll evaluate PHP and Python across various factors, such as
- Speed to Market,
- Security,
- Performance,
- Versatility,
- Scalability,
- Ease of installation,
- Debugging
- Web framework options,
- Environment Management,
- Developer Community & Support
- Documentation
Let’s dig in.
We respect your privacy. Your information is safe.
PHP vs. Python: The basics
What is PHP?
PHP is a scripting language first released in 1994 by Rasmus Lerdorf. Though most commonly used for web development solutions, PHP is a multi-purpose programming language. The name of the language initially stood for “Personal Home Page.” Later, it became a recursive acronym meaning “PHP: Hypertext Preprocessor.” Over the years, PHP has become one of the most popular technologies used in web development, though its design has attracted some criticism.
- PHP is open-source, which means anyone can download and use it to accomplish their web development goals. Also, developers worldwide can inspect the code, post errors, or contribute to bug fixes.
- PHP is simple and easy to use compared to many coding languages. Since the syntax is similar to the C language, anyone can get along.
- You can seamlessly integrate databases like Oracle, PostgreSQL, and MySQL with PHP.
- PHP offers cross-platform compatibility, which means you can run it on almost all operating systems and devices.
- The flexible nature of PHP allows you to integrate it with JavaScript, XML, and HTML easily.
- PHP performs faster than many scripting languages, such as ASP.NET, JSP, and PERL.
Besides these basic features, Python also offers PDO class, regular expressions, magic constants, command-line execution, and support for cookies.
What is PHP used for?
PHP is used to build dynamic and interactive websites and web applications. Some popular websites built on PHP are WordPress.com, Wikipedia.org, Facebook.com, Zoom.us, Canva.com, and Microsoft.com. According to W3Techs, around 77.5% of all websites use PHP.
Besides, PHP is also used to build RESTful APIs, SOAP web services, and data processing and visualization.
What is Python?
Python is a multi-purpose, high-level programming language. It was first released in 1991 and initially developed by Guido van Rossum. Over time, Python has become one of the most popular programming languages, adopted by many tech industry household names. Programmers can leverage Python for web development by using frameworks—such as Django, Flask, and Web2Py.
Beside being very popular among system administrators, for instance, Python is one of the most used languages in data science and data analysis, due to the number of great libraries built with the language for these usages. Tweet This
Python is a universal language. Through the years, developers worldwide have contributed to the Python ecosystem, creating several tools and libraries to solve problems over various domains.
- Since Python is open-source, anyone can download and use it for free. Also, developers can use and modify the publicly accessible source code of Python based on their needs.
- Python is easier to learn than other programming languages, such as Java, C, C++, and JavaScript.
- As an object-oriented programming language, Python lets you access features like object encapsulation, construct and destruct, and classes.
- Python is an extensible language. It means you can write Python code in C++ and compile it without any hassle.
- Since Python codes are executed line-by-line, debugging is much easier and less time-consuming.
- Python code is portable, which means if you’ve written Python code for Windows OS and want to run it on other operating systems, you can do it without changing the code.
What is Python used for?
Here are some simple use cases of Python:
- Web Development: Python has frameworks like Django and Flask, which lets users build web applications quickly and efficiently.
- Data Science and Analytics: You can use Python libraries like NumPy, Pandas, and SciPy for data analysis, visualization, and machine learning.
- Artificial Intelligence and Machine Learning: Developers prefer Python for building complex AI and ML models because of its simplicity and readability.
- Scripting: You can also use Python for automation and scripting tasks like system administration, network programming, and automated testing.
- Game Development: Python has libraries like Pygame that let you quickly develop 2D games.
- Desktop Application Development: You can use Python frameworks like PyQT and wxPython to build cross-platform desktop applications.
Python vs. PHP: An in-depth comparison
1. Speed to Market
What new currency sets a business on the path to success, you ask? Time is the answer.
In today’s highly digitized world, businesses continually look to speed up their digital transformation journey. It would be best to build an MVP as soon as possible to raise funding for further new product development. And this is the primary reason you must choose the correct language for your web application.
As its official website quotes, Python is “powerful… and fast….”
Python has an excellent set of third-party libraries, modules, and packages to complete projects faster. For instance, Django is one of the most famous frameworks for web development written in Python. It leverages the MVC (model-view-controller) pattern to allow developers to create applications with excellent separation of concerns and reusability quickly.
PHP also comes with its tools, including libraries and frameworks. In the PHP camp, the most popular framework is Laravel, which also adopts the MVC pattern and comes pre-packaged with many valuable features for development, such as authentication, routing, templating, and more.
Verdict: For this criterium, we have a draw.
2. Security
Security Vulnerability goes in tandem with the web development process. Here are the reasons why:
- Web development is a rapidly-evolving field where new technologies and frameworks emerge. As a result, it becomes challenging for developers to keep track of the latest security threats and take steps to mitigate them.
- Sometimes, the emphasis may be more on functionality than security. As a result, some security vulnerabilities may slip into the web application that attackers may exploit.
- Human errors, like failing to sanitize user input, can result in serious security vulnerabilities.
The cost and time to fix these vulnerabilities increase exponentially as you progress through the software development lifecycle (SDLC).
The graph indicates that it is 30x times more expensive to get rid of vulnerabilities during the post-production phase than during the design, requirement identification, and architecture stage.
Regarding security, Python is the most recommended choice for businesses. For instance, the Django framework comes up with built-in security features, which help in protecting the application from various security threats.
Moreover, as per WikiLeaks, numerous government agencies like the CIA rely (heavily) on Python as their secret hacking tool. Apart from the CIA, various other US organizations that store sensitive data use Python as their backend language: the Department of Education, the Department of the Navy, and the National Institute of Standards and Technology (NIST), to name a few.
On the other hand, PHP has had a frightful history regarding security. Although most of the security issues have been addressed due to robust community support, PHP fails in terms of security compared to Python.
3. Performance
Application/Website speed is a vital factor that helps determine its performance and fluidity. A Google study says that 53% of mobile site visits leave a page that takes longer than three seconds to load. Today’s era of experience relies on speed: releasing software to production multiple times a day is critical.
Python, as we mentioned, is fast and powerful. The Just-In-Time compiler of Python makes it faster than its competitor, PHP. One of the main advantages of JIT is that once the files are compiled, they are not needed to be recompiled.
On the other hand, PHP’s earlier versions, PHP 5.x, were much slower than Python’s. However, the release of PHP 7.x brought a turnaround, improving applications’ speed significantly. With PHP 7, Zend Engine 3.0 was released, making PHP 7 twice faster as its predecessor.
Verdict: The winner is PHP. All credits go to Zend Engine 3.0 of PHP 7. However, it’s important to mention that PHP defeats Python just by a marginal difference.
4. Versatility
Nowadays, web applications are more than just developing simple portals or websites for information. Instead, AI is also becoming an essential part of the web and other emerging technologies. All businesses with online customer service portals use advanced AI and machine learning algorithms.
Such algorithms help businesses identify their users more accurately, coupled with machine learning, and identify specific domains of their business that they should funnel their investments.
Uber built an ML platform using Python called Michelangelo PyML (an extension of the initial Michelangelo product). This platform enables them to make predictions, both in online and offline mode, thereby solving day-to-day tasks. Users can validate models with PyML and replicate them in Michelangelo for complete efficiency and scalability.
Python has many libraries that are powerful as compared to libraries provided by PHP. These libraries include assistance in all domains, including NLP (Natural Language Processing), image processing, and many others.
5. Scalability
When products succeed, businesses grow, and as the company sees an upward trajectory, its user base grows too. In this case, it is a priority for any business to have an application that easily adapts to the rapidly changing customer and market demands. Thus, choosing an app development technology that can help your business scale up is essential.
In terms of scalability, the apps built on the Python framework offer high AI and ML capabilities, leading to increased scalability and easy adaptation to evolving trends.
For instance, using the Django framework, you can build scalable apps as this framework constitutes a series of wired-up and ready-to-go components that are decoupled (implies independent from each other). Thus, these components can be unplugged and replaced per the business’s varying demands.
Instagram, for instance, features the world’s largest deployment of the Django web framework. The social networking service credits its decision to pick Python over PHP to the former’s reputation for simplicity and practicality.
Even when Instagram has doubled in size and felt the need to maximize its web service efficiency, Django has helped maintain simplicity and practicality and scaled to handle millions of users.
On the contrary, PHP is less open to growing demands and new trends. Despite its continual improvement, PHP lags behind Python apps, thus losing the ‘Python vs PHP: Scalability’ battle.
6. Ease of Installation
PHP is easy to install, whether you want to install it on Windows, MacOS, and macOS. Also, it can seamlessly run on all these operating systems. You can even find it on many shared hosting websites worldwide for a minimal fee.
While LinkedIn users can easily install Python, installing the language on Mac OS X and Windows is complicated. The Mac OS X comes preinstalled with Python, which is so outdated that you can’t use it for application development. As a result, you have no choice but to install a new Python version.
Installing Python on Windows is equally tricky. You must use a package manager like Chocolatey to overcome this and avoid issues. However, it is extra work, especially if you plan to use Python as a team.
Verdict: PHP is easier to install on each operating system than Python.
7. Web framework options
Both PHP and Python offer various frameworks for web application development. Common PHP frameworks are Laravel, CodeIgniter, Symfony, and Zend. Laravel, Symfony, and CodeIgniter are widely used because of their rich performance, high scalability, and minimal configuration requirements.
Also Read: Why Laravel is the Best Choice for Web Application Development?
Django, Flask, CubicWeb, Bottle, Pyramid, TurboGears, and Pylons are popular python frameworks. Django and Flask are widely used because of their ease of use and rich features.
Also Read: Flask vs. Django in 2023: Which Framework to Choose and When?
Verdict: Both PHP and Python support various web frameworks. Hence, there is a tie in the PHP vs. Python tug of war-regarding web frameworks.
8. Environment Management
Environment management plays a critical role in web application development by offering a controlled and stable development environment for each phase of the application’s lifecycle. It improves collaboration, speeds up development and testing, reduces downtime, enhances security, and successfully delivers high-quality web applications.
virtPHP is the environment manager for PHP. However, it was archived a long time ago. A better option is containers like Docker and Kubernetes, which developers can use to run a software process, a small microservice, or even an extensive application. A container also offers advantages like
- Reduced overhead,
- Consistent operation,
- Increased portability,
- Improved efficiency
On the other hand, Python uses the Virtualenv environment manager, which is highly efficient and valuable for environment management. Using it, you can install and manage multiple Python versions side-by-side. You can even switch versions quickly. Also, Virtualenv is highly popular among developers with 10+ years in the market.
Verdict: Python is the clear winner in terms of environmental management.
9. Debugging
Debugging is tricky in PHP. However, with PHP debuggers like XDebug, you can quickly get along with it. Similarly, Python has a brilliant debugger called Python Debugger (PDB) that is easy to use, especially if you’re a beginner. All you need is to press the debug button, and you can get rid of bugs in a few seconds.
PHP and Python debuggers like PyCharm and Visual Studio Code also allow integration with IDE – allowing you to track and fix issues seamlessly.
Verdict: Both PHP and Python debuggers are easy to use. Hence, it’s a tie.
10. Developer Community & Support
Since PHP has been around longer and has a large user base, many online documentation, tutorials, and forums are available. Also, the PHP community manages many open-source projects, libraries, and frameworks. They’re also always ready to help and share their knowledge with others.
On the other hand, Python has a younger but rapidly growing community. The language has become famous recently due to its simplicity, versatility, and efficiency in domains like data science, machine learning, and web development.
The Python community has significantly contributed to the development of many open-source projects, libraries, and frameworks over recent years. You can also find many online resources and forums for Python. If there’s anything you still can’t grasp, you can reach out to its welcoming and supportive developer community.
Verdict: Both PHP and Python have strong and active communities that offer great support. You can easily find websites and platforms to ask questions, hone your skills, or find solutions to any problems with web application development.
11. Documentation
Both PHP and Python have comprehensive documentation. You can easily find forums, tutorials, discussion boards, websites, and courses for both languages to aid in software development.
PHP even has a documentation website covering everything you need to know about the programming language in over 10 languages. Developers can leave comments on each page to clarify complex concepts with easy examples.
The downside of this feature is that comments, once posted, remain there forever. Hence, comments related to previous versions sometimes show on top, creating confusion. As a result, developers fail to understand what issues have been addressed and what they’re still working on.
Python also has in-depth documentation for each version with a table of contents, new improvements, usage, tutorials, FAQ section, extensions, library references, etc. Also, you don’t see the comments as you did in this documentation – which avoids the confusion but makes it slightly challenging to understand some concepts for new developers.
Verdict: Python documentation is more organized than PHP, as the user comments create a lot of confusion.
Similarities between PHP and Python
- Python and PHP are open-source, meaning you can use, distribute, and modify them for free.
- Both languages are cross-platform, so you can run them on different operating systems.
- Python and PHP enjoy active community support from developers who are always willing to help you with your queries.
- The code of both languages is executed line-by-line without compiling.
- PHP and Python are high-level programming languages supporting method chaining and dynamic typing.
PHP vs. Python: the differences
Type of Programming language | PHP is a scripting language for developing web applications. | Python is a general-purpose programming language. |
Learning curve | PHP is a bit more challenging to learn than Python. | You can easily learn Python. Even beginners can easily get along with it. |
Popular Frameworks | Laravel, CodeIgniter, Symfony, CakePHP, Zend, Yii. | Flask, Django, Pyramid, Web2Py, Bottle, Tornado, TurboGears. |
Speed | PHP 7. x and PHP8 are extremely fast, almost 3x faster than Python. | Python is fast and can help develop apps quickly. |
Database Connectivity | You can seamlessly connect 25+ databases in PHP. | Python allows database connectivity, but not with all databases. Also, it needs drivers to connect with databases. |
Syntax | PHP syntax is complex | Python syntax is clear and crisp. |
Library Support | PHP lacks wider library support. | Python offers vast library support for all types of web applications. |
Popularity | Very popular (around 79% of websites use PHP) | Lest than 1% of websites on the Internet use Python. |
Readability | PHP is less readable, and maintainable | Python is highly readable and easy to maintain as it was designed to reduce complexities. |
Functional Programming | PHP does not support functional paradigms. | Python supports functional programming methods. |
Security | PHP security is a matter of concern, as many security attacks have been witnessed in the past. | Python is secure as it has built-in cybersecurity features. |
Usage | PHP is mostly for web application development. | Python has broader functions like web and app development, data analytics, AI, and machine learning. |
Websites built | Facebook, Yahoo, Wikipedia, and WordPress. | YouTube, Instagram, Dropbox, Uber, Quora, Pinterest, and Spotify. |
GitHub Starts & Forms | 30K Stars & 8.04 Forks | 30.04K Stars and 8.23K Forms |
How Net solutions can Help in Building High-quality Web Applications?
The success of every business lies in robust, high-performing, and user-centric web applications that focus on solving customer’s pain points and maximizing user engagement. Creating such apps is possible only if you’ve a reliable PHP and Python web development services provider who can offer you the right help and guidance throughout the development process.
Net Solutions can help you maximize your reach and engagement with scalable web application development. Contact us if you’re looking to build a new web app or website for your business.
Frequently Asked Questions
-
01
What should be included in the application modernization strategy?
PHP is a simple programming language, so you can quickly learn its basics. However, mastering it takes time, practice, and dedication.
-
02
What is the most crucial aspect of starting with an application modernization solution?
Sometimes, you can use Python to replace PHP for web development. For example, you can use Python to build web applications using frameworks such as Django or Flask. These frameworks function similarly to PHP frameworks like Laravel or CodeIgniter. Also, you can use Python to build web services and APIs, which PHP applications can use.
-
03
Why is PHP not used by some big companies?
While many big companies use PHP for web application development, some avoid it for the following reasons:
- Since PHP was designed for small-scale web applications, it can be challenging for some companies to scale PHP web applications to handle high traffic and a large amount of data.
- PHP had some security issues in the past. Hence, some companies prefer using Java and C# in their place as they’re more secure.
- PHP is fast but less efficient than other programming languages, especially when handling extensive data and complex architecture.
- Some big companies use legacy systems built on older technologies like Java or .NET and may find switching to a new language like PHP challenging.
-
04
Should I Learn PHP or Python First?
Whether to learn PHP or Python first depends on your goals, interests, and the type of projects you want to work on.
- If your goal is to develop web applications, you should learn PHP first.
- If you’re into data science and machine learning, you should learn Python first.
- If you’re a beginner looking to learn a new language, you should choose Python as it is easy to understand and has a less steep learning curve.
Do you have a path-breaking product idea in mind?
Contact our experts at Net Solutions for your next PHP or Python web app.
Steve Spence
7:38 PM, May 10, 2021
I'm a Sr. Web Developer for an overseas contracting company for 2 years. I've been developing web sites with PHP for over 20 years. I consider myself very experienced in HTML / CSS / PHP and MySQL. I also develop standalone Python applications, primarily on raspberry pi, for IOT / GPIO manipulation. For the last 6 months, I've delved into Django and flask, and I just have to shake my head when I hear anyone recommend either of them or python in general for web development. Are you deliberately trying to make the process stupid? Back to PHP. Version 8 rocks!
Payman Sazesh
12:40 PM, Apr 06, 2021
Thank you so much for your nice, complete and professional essay about python and php
Ruhi Sharma
4:45 PM, Mar 16, 2021
Really appreciative content which very helpful well understood to read.Thank you.
Kiran
12:54 PM, Sep 14, 2020
This article is not useful as its very prejudiced only for criticizing PHP.
David Saylor
1:17 AM, Sep 08, 2020
SQL Injection is super old news. That's a thing of the past.
Herbert Ramirez
4:58 AM, Aug 30, 2020
Esta un poco sesgado y se nota la falta de imparcialidad, primero no es por un margen marginal que gana Php 7.x a la ultima versión de Python que se regocija de su velocidad pero pierde frente a php... Sino que fue un margen realmente considerable.
Segundo no es justo sacar una y otra vez las vulnerabilidades de php, ya que desde la versión 5.6 en adelante ha mejorado y ni hablar de php 7 que a diferencia de Python 2.x a 3.x que fue incompatible creando mucho problemas para los usuarios de ese lenguaje al actualizar el python obigandoles muchas veces en rehacer el proyecto, en el caso de Php, simplemente se puede agregar poco a poco codigo de php 7.x sin necesidad de que afecte lo ya hecho en versiones anteriores y eso permite a las empresas que tienen sistemas hechos en php irse actualizando sin problema alguno además de la gran mejora en seguridad que ofrece php.
Otra cosa los marcos o framework que veo que convenientemente no nombró acá como LARAVEL, CODE IGNITER entre otros, tienen mucha mas documentación actualizada y están a la vanguardia tecnologica que no tienen nada que envidiar de los nombrados en Python y yo en mi caso prefiero mil veces irme por Laravel sin problemas alguno. Sin mencionar que el mejor gestor de contenidos para web sigue siendo Worpress que se sostiene y es escrito en PHP y sigue liderando el mercado, cuya tendencia por ahora sigue en crecimiento constante.
Otro fallo, PYTHON es mas antiguo que PHP, Python salio alrededor de 4 años antes que PHP, si vamos al caso en el desarrollo web fue PHP el que se hizo con el mercado del desarrollo web y constantemente tiene mejoras. No es un mal lenguaje, es un lenguaje muy permisivo donde el buen programador aprovechará al máximo las cosas buenas de php, pero el programador flojo aprovechara las libertades para escribir mal código. Realmente es una falla mas del programador que del lenguaje. En 2020 en programación web pura y dura, PHP sigue siendo mejor opción, que fue el área para el que fue concebido, para todo lo demás puede usar Python. Actualmente trabajo con ambos lenguajes.
Rahmat
2:57 PM, Jul 18, 2020
hmmm its ok
Wole
12:10 PM, Jun 17, 2020
No write-up can be more biased and prejudicial.
Chris
1:43 PM, May 22, 2020
4+1. Ok, 5 points.
Points 1, 4 and 5 are actually the same: "All the hot machine learning stuff gives python first-class citizenship". Heck yes, that's true, and even playing around doing fun stuff, python is getting more and more involved in my workflows because tensorflow nets and friends are just so fun! I think if you build a website in PHP there will come a point where you introduce some python tooling. Imagine thinking that php couldn't be used for web scraping.
Python wins here. But it's just one reason, not three.
Point 2 hasn't convinced me that either language is safer than the other. You mention "SQL injection, cross-site request forgery, cross-site scripting, etc" as the focus. PHP has protections for these things built into its standard library (eg PDO). There's no option here. You either develop with PDO, filters etc, or you reinvent the wheel! I don't think that python is any worse in this regard. Have you seen the damage you can do by writing careless C? Does it mean that C is less secure than PHP? Nah. I don't see how an intelligence agency using python shows that it's any more or less secure than every other language on the planet. The CIA is using python, not java. Java has a much stricter type system and forces you to be aware of certain types of exceptions. Can you say that java is inherently less secure than python just because the CIA (or your friend from school) is not using it? No.
There is no evidence in your post that either language is intrinsically more or less of a security risk than the other.
Point 3 is garbage. Python is ""slow"" and it always has been. Try using it in a quick shell script. Writing code loop for loop and value for value, any task you can think of will complete on php before the python interpreter is even fully loaded. Even java executes faster than python. PHP7, what? No, try PHP5. "PHP’s earlier versions, PHP 5.x, were much slower than Python"? Rubbish! Even with php5 it was normal to use an opcode cache - php executes bytecode. Why the bizarre implication that PHP can't do any form of compilation? It's a stateless bytecode machine. Python can't compile the entrypoint, PHP can. Say no to drugs.
I do agree, however, that php wins this one.
Also it's pretty strange to cherry-pick a few sites and say "these use python therefore python is better". Facebook was largely built on PHP. They were attached enough to create hacklang and the hiphop virtual machine. Things that were written in PHP have been ported or transpiled to compiled languages to increase capacity. Does Wikipedia run its mediawiki software on python? No, it's PHP. Check their article Programming_languages_used_in_most_popular_websites (which I don't think lists their own site) and you see that most big sites do not use python! About the same penetration there as PHP. So really I can hand-pick sites to say whatever I want, even that C++ is the best language for web.
Anyway, all-in-all you make 3 points. Evaluating them sensibly, one goes to python (machine learning), one goes to php (speed) and one is not even a language-level issue (security).
Now me, I'm enjoying python a lot more than php right now. I feel a little more comfortable leaving python up as a long-running application. It's got a bazillion GUI modules which just don't make sense in PHP, and it's really mature in terms of interacting with C symbols from within python, or embedding python in other applications.
Great article, has generated a lot of discussion. But your arguments lack substance or foundation. They're split into points but the points are redundant and full of fluff and buzzwords.
Anyway, I wouldn't try to steer anyone away from writing in python or php, provided they were playing fun and responsibly. Sometimes you're going to find that PHP is a lot easier to handle, and sometimes you're going to find that PHP is just a stupid choice. Sometimes python will offer what you need through just 4 lines of code, and sometimes it just won't have what you want. Personally, I pick a language because I want to use tool x which is well supported by it. I don't pick a language because I think it's some panacea for speed and security or because I think it has pretty syntax.
Kieran Grosvenor
3:54 PM, Feb 10, 2020
You clearly do not know anything about web development if you think python is better then PHP for MVC apps, why would you want to worry about indentation? If you are going to use Python use it for machine learning or something it was intended for.
How is Python my versatile? I can install php with ease on almost all servers, most come with php and apache installed by default, your points are mostly invalid in this article...
George
9:59 AM, Feb 04, 2020
Lol...
“ the reason being the flexibilities which python provides such as the absence of pre-defining data types of variables, dynamically bindness and many others.”
Disregarding, the very informative “many others” point, dynamic variables and bindness (which is not a word) are literal descriptions of PHP as well.
Rafael
7:51 PM, Sep 17, 2019
I'm a python/php developer and Love both languages. I'd suggest anyone who is starting to try Python over PHP but.. I strongly desagree wehn you say that PHP comunity is no as large as Python's.
Khoa Pham
3:10 PM, Aug 27, 2019
The funny thing is this website was built by WordPress :))
Anyway, i love both PHP and Python
jenster
2:17 AM, Jul 26, 2019
So far the only thing that really turns me off from Python are the endless stream of articles like this and every IT person I've ever met insisting that it is just so superior to PHP. Python pushers aren't really doing the language much of a service with their superiority complex.
If you want to promote Python, how about supporting (or starting) hosting companies that offer Python-specific servers and services. Or help to develop Python's web- and security-related tools and functions to make it more viable for straight web development. Better yet, take your case to CEOs and Project Managers - you know, the people who actually decide which types of projects to develop (and usually which languages to develop them in).
The fact is, PHP is the clear winner because it dominates 99% (or more) of the market - and has done so for well over a decade. A budding developer has choices. He can learn PHP and have thousands of jobs to choose from developing real projects in the real world to solve real problems (no matter how ugly). Or he can learn Python and feel good about himself for writing "pretty" code. I agree, it might be more elegant code - but that doesn't much matter much if nobody is buying it. At least for those of us who care about supporting ourselves (and our families).
In summary, savvy developers react to market forces and learn to do what the market actually desires - and create things in the real world. Idealists, educators, and commentators then get the luxury to sit back in their high towers and criticize them for daring to create something because they didn't use the most ideal tools to do it. Tale as old as time.
Antoine
3:46 AM, Jul 10, 2019
While PHP7 kill Python eaaaasily, look for PHP8.
It will be a game changer.
I can't say it will better than an node backend, but this will clearly kill a couple of web backend language.
PS: this is so much funny people think that PHP is ONLY for web ?.
I just finished an React Native project using PHP rest API (my backend was already made) and this is now on Android, iOS and Windows using PHP as backend.
Fast and secure.
Bart
10:21 PM, Jun 28, 2019
I work in php webdev about 13 years, for about 6 I use python for iot and ml. I relay have to say few words:
1. Each language is so elegant as developer is, and if you look around You can see both good and bad examples. So point 1 is not true. (no winner)
2. My first language was C so in my case PHP was VERY easy and i think in general for anyone whit C-like background PHP wins. So in point two it's depend of individual background. (no winner)
3. I use Symfony, Django and Flask. Picking winner is easy and it is Symfony. Why? Easy, robust, well documented, clean. (PHP winner)
4. Most people says that python is easy to read - probably they did not see code that was written as "write and forget". But it is same as first point - developer depend. It true that python force you to do indentation, but ( it may by my C background ) i relay prefer " { } " (no winner)
5. Are we again in point 2 or in 4? :) (no winner)
6. Did you use debug in Symfony ? Probably no :) (PHP winner)
7. Did you ever see composer? Get it on https://getcomposer.org/ :) But its true PIP is awesome (Python winner)
8. OK, lambda is great, in php you have anonymous functions ;) (no winner)
9. True, php is mostly for web, while python is good for prototyping everything else. (PHP winner)
10. Python have big community around python and everything, php have smaller community around php and webdevelopment :) (no winner)
11. You forget about hosting (PHP winner)
12. You forget about security (PHP winner)
Let's say this clean webdevelopment - PHP (plus JS on fronend :) ) else ( if writing in C/C++ take to long ) Python.
Ravi Kumar
1:37 PM, Jun 25, 2019
With the help of python programming you can easily makes your website in a better way. As its a advanced programming you will get to also work in AI, Machine Learning.
Mitesh Sharma
7:15 PM, May 17, 2019
Python and Php both are great langages. Php is much more in web development but Python has much wide sectors like web development, ai, machine learning etc.
Christoper Stalin
12:59 PM, May 13, 2019
very useful blog, nice explanation, but little difficult to understood the content.
Usman
10:15 AM, May 11, 2019
Graeme you are 100% right
TK
11:56 AM, Apr 30, 2019
Biased much? I'm familiar with PHP and am learning python for its use in machine learning and blender scripting. This article caught my eye but did such a poor job of arguing that python is viable for web development that considering it over PHP is clearly just silly unless for some reason in particular python was needed for an unusual project.
And the irony of this trash being posted on a wordpress site is also a nice touch. lol
Ferdinand
4:26 AM, Apr 08, 2019
This article triggers me! It makes me cringe really. Badly written, no basis! Just bad. I bet whoever wrote this is a die-hard python fan, or not really programming in php.
BK
10:11 PM, Mar 15, 2019
I use both PHP and Python on a regular basis, You're going to have a hard time convincing me that a programming language that uses whitespace for structure is superior and more elegant. Sure, I'll give python credit in that it's maybe easier for someone with no previous experience in real structured programming languages to learn. That's really it's ONLY advantage though. Python is not more robust or powerful than PHP, it's just the latest fad for script kiddies and people with little to no actual programming experience.
j
12:42 AM, Mar 09, 2019
You don't even mention Laravel?? Halfway through this "article," I had to scroll up to look at the date because I figured it was 10 years, or more, older...I stopped reading when I realized it was written a few months ago. And... "but there probably aren’t any code bases using it to the extent that PIP...does" ... o.O are you high? You're trying to say pip is superior and in more production environments than composer?!? Wtf? You are clearly a python developer trying to get noticed and no nothing about modern PHP and seemingly not that much about OOP or web development in general, either.
Nwakasi Stephen
10:07 AM, Feb 25, 2019
Starting out web development with Django is probably not a good idea if you want to understand "web programming." A huge part of the work has been done for you. You don't even see the logic sometimes, but it works. So with Django, you do not need to write a lot of back end logic, just stick to the Django-rules.
I am going to say here that anyone who wants to program the web and also wants to know how and why things are done the way they are should start with something else, not a framework. And PHP is a good start.
Ananya Roy
7:54 PM, Feb 07, 2019
This is so ridiculous. Kindly read the benefits of PHP because there are many.
jim
9:46 PM, Jan 29, 2019
I am really surprised at how bad this article is. The author clearly does not have any knowledge of PHP, OOP or modern PHP frameworks. For instance, the use of lambdas. PHP does support lambdas but you simply don't need them in OOP.
Graeme
1:33 PM, Jan 10, 2019
And what about the disadvantages? Like the fact that PHP is easy to run on most modern hosting servers without much setup, yet Python is not and requires more expensive hosting packages to install the necessary software to compile and run your code? Not gonna lie, I was hoping for a more wholistic argument to help me with my problem, not your “python-is-better” article.
B Chast
12:47 AM, Jan 08, 2019
It is not PHP or Python, but which one works better for the project you are working on. People should have the freedom to choose for themselves whatever is going to work best for them. Both languages are easy to learn and a developer doesn't have to choose one or the other nowadays. Why not both? PHP has advantages over Python for simple websites and doesn't rely upon some IDE for web development like Python (unless you want to code all of that yourself).
Fang Hao
1:35 PM, Dec 17, 2018
You clearly dont know much about modern PHP
Sunday Adejoh
2:02 AM, Nov 03, 2018
Good evening sir, am a young aspiring developer from Nigeria, please just tell me which to learn PHP or Python??
Daniel Craig Jallits
7:31 AM, Sep 13, 2018
Most of your arguments regarding PHP are severely outdated. Since 2012, the language that has made the most significant advancements is PHP.
For instance:
Composer beats the snot out of PIP for package management.
PHP 7 is a complete smoke show compared to previous versions, and I’m stoked that a JIT compiler is finally being included in v8.
Laravel right now is the clear winner for PoC development and Symfony for Enterprise applications.
Forget Drupal, WordPress or Drupal as those are applications and do not properly represent PHP as a whole. Those are just segments of a much wider, active and thriving user base, that is not nearly as toxic as some of the other language communities I’ve been involved with.
Mohammad Ashrafuddin Ferdousi
3:59 AM, Aug 19, 2018
Nice writing and I am writing you at 2018! :)
I agree with you only with the last point. But I seriously think you should look at 5.6 or greater, specifically php 7.2. You may also check PSR. In context of programming and better programming practice php 7 is playing a great role. Now-a-days php libraries are glue and exchangeable! These all are amazing for programmers' community.
The main problem I find is lack of good php developers. As php is a forgiving language even now, lots of people start programming in php and able to make something visible! They need to be trained up with professional software engineering technique and best practices.
Otherwise, php has lots of features like type hinting, interface, traits and obviously class. If someone follow the correct techniques, this is even better language than ruby or python in context of web development.
In theory, lots of people says about needle haystack issue. But with a good IDE its not so much bigger issue! Even python have "self" which is a design mistake and its not a big deal. At day end, we produce softwares by writing codes. If we have enough knowledge, we make things correct!
Thanks!
William Taylor
2:21 PM, Aug 17, 2018
I have been a programmer since 1974, just looking too deepen my Python experience as I think about converting some Php AI applications to Python to too merge too chatbot technologies together.
While I did enjoy reading this piece, but it was way short of providing anything more than opinion. If you do update it with some references or examples, please email me.
Cheers,
Harry Corner
7:26 PM, Aug 03, 2018
I liked the post. However, I felt during my read as though few of those points are rather opinionated than comparatively defined.
Ali
6:42 AM, May 08, 2018
I have spent 2 years building my online reservation system and backend Administrator portal using HTML/CSS on the frontend, javascript/jquery with ajax functions and php scripts. I understand Python is so popular now a days but I am having a tough time understand what part of my html + css + javascript/jquery + ajax + PHP I would replace with Python? And why would I replace it with Python?
Rik Roos
3:26 AM, Apr 04, 2018
I've learned Django and I agree that this is not something you will do on one rainy Sunday afternoon. But the logic of the framework is very consistent. After a couple of days you can build a library-site or a blog-site with authentication (login) and authorization (perform special tasks) options. But before learning Django you should learn HTML, CSS and Javascript well; my advice is ignore the frameworks like JQuery and Bootstrap; start with the basics.
James Patricia
5:36 PM, Mar 14, 2018
PHP is Server Side Scripting Language compatible with all known OS like Windows ,Linux etc .Nowadays, PHP frameworks are being extensively used by programmers to address to performance tuning issues faster and with ease.Thank you for sharing this amazing blog with us.It was very informative blog.
noshad
8:34 AM, Feb 28, 2018
that haha moment when you build your website with php wordpress just to write php is bad compare to other language
jc
9:50 PM, Dec 22, 2017
I agree to some of your point but package management in php is still light-years ahead of Python even at this time.
Look at composer and packagist and compare that to pi, pipy and virtualenv. good lord.
Gaurav
7:34 PM, Dec 14, 2017
Could you provide me some online websites names to learn python free of cost.
Paul Wakhungu
5:57 PM, Oct 11, 2017
The article seems to have been written by someone who has not had a first hand experience with PHP. Readability of code for example depends on how the code is structured, which of course is dependent on the developer. The entire article seems full of opinions rather than researched work.
Ram krishna
5:59 AM, Jun 03, 2017
I went through the content and portfolio, I am new in both the langs, i.e PHP & python.
I have a simple question to ask you.
By using any language, why not a 100% standalone product get build, without post support work?
EBIOWEI
1:02 PM, May 19, 2017
I am a total beginner who hasn't even known how to start, I want to know if Python can be used single handedly to build a cloth shopping website. Is it thesame Python 3 I want to start learning that I'll use, or is it that python for web development is a different thing than Python for normal apps like mobile? Please if this question is silly forgive me, I just need to know what's what.
Jayan Gopinath
7:08 PM, Apr 10, 2016
I agree with Python's ever increasing popularity. And innumerable no. of third party libraries in several different verticals are available for Python.
Thanks to Guido van Rossum.
Nope
9:23 PM, Oct 03, 2015
Nothing you've written about PHP is actually accurate, and the rest is opinion. But wonderfully "objective" little article you've written.
erm3nda
4:54 AM, Sep 02, 2015
Definetively yes, that's why i move from PHP to Python.
But for novices, PHP is the quick way to create their little app's :D