Python vs. PHP

Jason Martin
Python vs. PHP

Should I use Python or PHP in Custom Software Development?

If you’re a decision maker at your company tasked with finding/developing custom software, one of the first questions you’ll need to ask yourself is which language your program will be written in.

As custom software developers, we get that question all the time. And when our clients learn that we develop our applications in Python, they ask why we choose it over other alternatives – PHP, for example. Of course, there are hundreds of other languages that could be taken into consideration here, but we wanted to look at PHP and Python because they’re two of the most popular scripting languages (meaning they are usually interpreted, rather than compiled like C++ or Java)

The answer is actually pretty black and white. Asking whether Python or PHP is a better development language is like asking if English or Spanish is a better spoken language – of course, they’re both great! If they didn’t work, they wouldn’t be used by millions of people. But if you’re traveling into the heart Mexico, which would you rather speak? That’s where the answer becomes simple. The type of software you want to develop will determine which language it should be written in.

Let’s take a look at when it makes sense to use either Python or PHP when developing custom software.


Background and Current State of Python

Python started as an idea in the 1980’s. The first version was released in 1989, developed to work with the Amoeba time sharing platform. Amoeba has long since been left behind, but Python continues today as one of the most popular, useful, and beloved programming languages.

Python has won the hearts of many in the development community for its simplicity and readability – it typically uses less lines of code than PHP and other languages, and is more readable because it trades complicated and messy syntaxes for white space and code that reads a lot like english.

The recently released 2018 TIOBE Index lists Python as the #4 most popular programming language, and the most popular scripting language overall. (Note: the TIOBE index refers to popularity on the internet measured with over a dozen different search engines/communities)

Python Ranking in TIOBE Index

In addition to its popularity in the TIOBE Index, Python is also the language of choice for many of the internet’s most powerful websites and applications. Here are some websites that use Python and the Django Framework:


Background and Current State of PHP

PHP stands for Personal Home Page, and, you guessed it, was developed specifically for website development. It’s been extremely successful at it, too. WordPress, the CMS giant that powers thousands of blogs and websites, is largely based on PHP. Sources also claim that “PHP is used in 83.1% of all the websites whose server-side programming language we know”.

Because PHP is so widely used for web pages and is easy to learn, it’s become a favorite of hobbyists who pick up web development on the side. It’s lead to a reputation with some that PHP isn’t clean or scalable, but in reality huge systems have been built using the language. The efficiency of code depends on the developer, not the language (although certain languages are most definitely more suitable for certain tasks).

While PHP has definitely had a lot of success, it’s not nearly as beloved as it’s rival, Python. PHP is actually regarded as one of the more hated programming languages. Although that may be the case, it still takes the 9th spot in the TIOBE index and continues to be one of the most useful languages out there.

PHP in the TIOBE Index


So when should I use Python or PHP?

Let’s compare the two:

  • The more popular scripting language according to the TIOBE index.
  • Generally considered to be one of the most beloved languages by programmers
  • One of the easier languages to learn, but most say it’s more difficult than PHP
  • Built for simplicity, versatility, and to be easy to read (it leaves behind the syntax used by other languages). This means fewer lines of easier to read code, which will drive down maintenance costs.
  • The language of choice for large scale, versatile, and flexible applications. For example, Python isn’t limited to web development. iOS, Android, and Windows Mobile all have ports or frameworks for integration with Python.
  • Applications written in Python are considered to be some of the safest.
  • The most popular scripting language in terms of usage: PHP is used by over 80% of websites
  • More lines of PHP code = a larger base of developers experienced with PHP
  • Generally considered to be one of the most hated languages by programmers.
  • One of the easiest languages to learn
  • Stands for personal home page, and was built specifically for graphical web pages and interfaces. This gives it an edge with simple web applications such as blogs (wordpress is a PHP platform, for example). These would also be easier and more cost effective to develop with PHP.
  • Limited to web development.
  • PHP has had critical security vulnerabilities in the past, and is considered more difficult to secure

Side by side, the evidence is pretty clear. Python should be used in developing more dynamic, complex applications (think custom CRM development). If you want to reduce the time to your first version and just need a simple end product that will look good, then PHP is your winner.


Use Cases of Python and PHP

Just to cement that claim, let’s take a look at some use cases and success stories for each language.

Python success stories can be found here. The community has done a great job of compiling these, and it’s a pretty diverse list.

The list goes on and on, proving how dynamic and versatile Python is.

As for PHP, it has its own impressive list of accomplishments, although mainly focused on web development (PHP’s website itself says the language is “a popular general-purpose scripting language that is especially suited to web development”)

  • As mentioned earlier, PHP is used on over 80% of websites
  • Blogging and CMS giant WordPress is written in PHP, making it the language of choice for any application that wants to plug into it.
  • Facebook also uses PHP. It’s argued to what extent the language is used, but it’s pretty clear that a good chunk of its systems leverage the language.

Hopefully it’s pretty clear by now – Python for dynamic applications, PHP for simpler web pages or sites.


Final note: Community and Future of Python and PHP

One last thing you might be worried about as you build your custom software is the maintenance and support going forward. They’re going to be pretty similar. Right now, there are more lines of PHP out there, meaning that for now, you’ll probably find PHP developers slightly more available and cost effective. However, 8 of the top 10 computer science departments are now using Python to teach development. Most developers already prefer to work in Python, and it’s popularity amongst them should lead to higher adoption rates and a higher availability (and desire) in programmers to work with it over PHP.

Interested in building your own Python application? We’d love to help!


Custom CRM Consultation