“There are only two kinds of languages: the ones people complain about and the ones nobody uses” – Bjarne Stroustrup,
People wonder: Did he really say that? Yes, he did. If you wonder who Bjarne Stroustrup is: He created the C++ programming language. Many people believe that Python is “pretty cool” and PHP is “really bad”. But as we all know, there is truth in the saying:
It’s a poor carpenter who blames his tools.
I believe both good and bad software can be written in any language. And I should probably also quote Joel Spolsky who calls “language wars” a “fruitless debate”. But nevertheless, if you program in PHP and run into one of these Python “evangelists”, then the following list may come in handy.
10 reasons why PHP is better than Python
- Python hosting, hard to find and expensive, while cheap PHP hosting is everywhere.
- Python cannot be mixed with HTML (needs a template library), while PHP can.
- Python has no proper encapsulation (private keyword), while PHP has.
- Python is hardly used in the real world, while something as big as Facebook is built on PHP.
- Python has a great community, but it is not comparable to PHP’s.
- Python has some books and tutorials, but PHP has way more of them.
- Python does not have the live docs (famous forum-like reference manual) like PHP has.
- Python does not have a steep learning curve, but PHP is still easier to learn.
- Python indentation for code blocks is prone to errors, while PHP uses curly braces.
- Python lexical scoping is a mess (‘global’ and ‘nonlocal’ keywords fix this), while PHP behaves as expected.
To wrap up
PHP has come a long way. Today it is a mature language that executes fairly speedy. Agreed that it has some quirky naming of it’s built-in functions, but hey.. that’s the price you pay for backwards compatibility.
Hint: Make sure to also check out this page on Python.org that is a good reference when comparing Python to PHP.