24 Sep Confessions of a web developer: PHP vs. Python
PHP and Python are coding languages used for web server-side programming, both of which come with their own advantages and dis. In this article, we’re going to explore the similarities and differences between them. To get a better idea of the languages, let’s briefly look at the history of them both…
PHP – History
PHP was created in 1994 when a guy called Rasmus Lerdorf wrote a series of components and extensions for the programming language: C. Today, PHP is a globally-used web programming languages which powers millions of websites – roughly 81% of the Internet, according to w3techs. This wasn’t Lerdorf’s intentions. In actual fact, the only reason he created PHP was to make managing his personal website simpler. Amidst PHP’s rapid growth during the late 90s, Lerdorf said during an interview:
“I don’t know how to stop it, there was never any intent to write a programming language […] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way.”
Today, PHP is maintained by The PHP Group – a team of dozens of PHP and C developers tasked with the development and progression of the PHP language.
Python – History
Python was created almost a decade earlier than PHP, in 1989, by Guido van Rossum. Unlike PHP, Python was developed with the intention of creating a programming language in mind. It was actually built to replace the ABC programming language. Python 2.0 was released on October 16th of 2000, with dozens of exciting new features – the main one being support for Unicode.
The main difference between PHP and Python is that Python is not primarily a web language. Due to this, it is nowhere near as popular as PHP. According to w3tech, it only powers 0.2% of the web.
PHP & Python Similarities
- Are open source, which means that anybody with sufficient knowledge can contribute to the code.
- Are portable, meaning they are able to run on all operating systems without issue.
- Have huge, active, developer communities behind them.
- Are considered easy to learn compared to other languages such as C++ and Perl.
- Have extensive, detailed documentation.
PHP – Main Differences
- PHP has a coding syntax much similar to that of C (the language on which PHP is based). Features of this syntax include special symbols like “curly braces” and brackets.
- Due to PHP’s wide usage, it is pre installed on most, if not all, web hosting platforms.
- PHP ignores whitespace in the code, whereas Python doesn’t and is very strict with the way tab and space characters are used.
- PHP is viewed by developers to have inconsistent function naming conventions, which is due to the fact that it was not initially intended to be a programming language. Things were constantly being added on by different people, without any uniform coding standard.
- Indentation is used to define block structure, whereas PHP uses “curly braces”.
- Python natively uses “packages” to import extra libraries your application may need. With PHP, you have to download and install the library manually.
- Python has support for major GUI (graphical user interface) frameworks, which means it can be used to create desktop applications as well as websites.
There are also hundreds of technical differences between the two languages that we haven’t touched upon, but this article should give you the general idea.
Here at Geonet, we use PHP on a day-to-day basis. We much prefer the concise syntax, and the fact that it is so widely used makes us well equipped to handle most websites on the Internet (about 81% in fact!).
If you need a new website, but not sure which language is best to use, consider what your website is being build for. Want to have a chat about your website and how we can help you? Speak to the professionals at Geonet! Pop in for a coffee or give us a call on 01325 361729