High-Level Concepts

Why Use PHP in 2019?

Let’s get it out of the way early: PHP is a strange and ugly language. It’s not exceptionally fast. It’s not beautiful syntactically. It’s not formulated around a clear opinion about good software development practices. And it’s still what I write a lot of software in. The obvious question is: why? Why use PHP today?

There are lots of good reasons for it, above and beyond personal idiosyncratic preferences. Here’s the space to cover exactly that. Why is PHP my language of choice for web development?

What is PHP?

“What is a PHP?” Or, more commonly, “what’s PHP?” In short, PHP is a programming language made for the web, built up from the C programming language, and which uses idiosyncratic HTML-like tags (or sigils) to contain its code. The PHP programming language is mostly used server-side, which means that it runs on your web server software, which is customarily going to serve HTML to your visitors.

PHP initially stood for “Personal Home Page.” Because that pretty thoroughly constrained the meaning and desirability of using the language for general use, the language now stands for “PHP: Hypertext Preprocessor”. This is what’s called a recursive acronym (a name that contains the name). Nerds love them.

What can PHP do?

What is PHP used for? Basically, anything that you want to do on a web server, you can do with PHP. Make a blog? Yep. Create a full fledged software-as-a-serivce application? Absolutely. Write a little script to process some data in a few seconds? PHP is great for that. Write a complicated set of scripts that accidentally becomes a successful software business? PHP is used like that a lot.

If you don’t trust me, the PHP website lists the following uses:

  • Server-side scripting
  • Command-line scripting
  • Writing desktop applications

I’m not so sure I’d encourage the last bullet point, but it is possible. But the first two are common and good reasons to use PHP in 2019.

This leads to one important and unavoidable fact…


There are a lot of reasons to know and love PHP, probably the most potent and valid of which is this: it’s used and runs EVERYWHERE the web does. Your cheap little $3 per month hosting account may let you run a web application in Python or Ruby if you shop carefully. But it’ll definitely run PHP. This means that you can count on it wherever you are.

Symony is one of the reasons that people choose PHP

And because it runs everywhere, and is easy to get started with, a lot of very popular software is written in PHP. WordPress is the example that’s both largest and most familiar to me, but tools like Joomla, Drupal, Magento, ExpressionEngine, vBulletin (yep, that’s still around), MediaWiki, and more are all running PHP on the server.

And there are more PHP application frameworks than you can shake a stick at as well: Symfony, Zend, Laravel, Aura, CakePHP, Yii, and even the venerable CodeIgnitor. Surely you can make a list of web frameworks of some length for almost any other language. And for the commonly used web languages like Python, Ruby, or Node/JavaScript you may even be able to amass a numerically competitive list. But the sheer volume of sites running PHP is immense.

WordPress proudly boasts that it powers more than 30% of the internet. You don’t need to even trust that fact to realize that a lot of the internet must be using PHP if that fact is even conceivably true.

PHP has some very good qualities

Easy Dynamism is Baked into PHP

PHP logo

PHP does HTML rendering and programming easier than almost any other language. So it’s pretty simple to change HTML to PHP. Just change your file.html to file.php, add a bit of dynamism inside some <?php and ?> tags. Most web servers will have already been configured to take care of the rest for you. It’s so simple that almost anyone can get started without a need for much more of an understanding of programming than this. Because PHP is so friendly to cut your teeth with, a lot of bad code is written in it.

Once you realize that most bad PHP is written by novice programmers, most of the fear and hatred of PHP you encounter in the world comes from one other essential problem: PHP has never had a grand design with a visionary idea about why it was the perfect language for your web server. Instead, its the result of wide collaboration through an open process which serve as a crucible through which any good idea — and a few bad ones — must pass.

Object-Orientation with (Great) Package Management is now the Norm in PHP

Composer PHP language
Composer is a great reason to use PHP

And bad ideas can make it through that crucible. The most popular example is that PHP 5.3 — separately widely regarded as the first modern version of PHP — introduced the goto statement, which is generally either scoffed at or thought an easy source for errors.

Similarly bad thing in PHP that have resulted from the process through which the language has grown: object-orientation was first implemented as a flawed and limited concept, the standard library is full of inconsistent names and parameter ordering, and (in an example that recently got a fair amount of attention) the :: token is called by the interpreter by the inscrutable-to-English-speakers: T_PAAMAYIM_NEKDOTAYIM.

But today, OOP is fully-realized in PHP. Few languages have as much Java-like OOP practice than PHP. What’s more, unlike Java, PHP has a single and widely-love package manager, called Composer. It was very good, and so the ease of pulling in other well-written and well-maintained libraries in PHP is nothing to be trifled with.

PHP Has Gotten a Lot Faster

But those thing said, PHP is evolving in interesting ways. It’s growing toward being a pretty fully-featured Java-like (for better or worse) object-oriented language. And much like Java, it’s gaining easy abstractions for functional programming — arguably the current hotness. It’s also growing a pretty awesome set of tools — PHP loves Composer, and for good reason — and a commendable effort to make all of these large open source projects in PHP work a little bit better together.

Oh, and we shouldn’t forget the current hotness: speed gains PHP has made in the PHP 7 series of releases. This is widely regarded as having been initiated by the HHVM coming out of Facebook. For a short time, there was a risk that the speed of the HHVM would fracture the PHP community. But it didn’t. Instead PHP just got so much faster that people have mostly forgotten that the HHVM exists.

PHP has a HUGE Community; it’s Learning-Friendly

If you’re deciding what cool new technology to use, a thing I think often gets to little attention is what’s its like to come to terms with the language. What’s it like to learn PHP? PHP tutorials are common and often quite good.

One downside of PHP’s popularity is that you can find some not-so-good training from people who don’t know enough about what using the tool is really like. Or who last were following “best practices” that were current a decade ago. But on the whole, that’s rare-enough that I don’t think it should discourage you. Finding out a practice you’ve used for a few months isn’t great is rare, and not a huge problem.

Common Comparisons to PHP

A lot of people new to programming are looking for very general face-offs of languages. So, here they come. All the languages I’m going to write up here have the following traits in common with PHP:

  • They’re open-source. What this means is that you can use the underlying language for free (no cost), and you are able to see and understand the underlying program if you wish to.
  • They’re often used for web development. Pretty straight-forward, these are languages used a lot for web development. Some are also widely used outside of that venue, but not all.
  • They’re high-level, loosely- and dynamically-typed. This means that a variable can change types, and that you don’t have to define when you define a variable what type of things (numbers vs strings vs objects, etc) it’ll store. This is generally favored for web programming, but not universally.
  • Their communities are good-sized or better. There are a lot of interesting languages that have the qualities listed above, but which don’t have a large community of practice. I’m leaving them aside here.

Why use PHP? Why not JavaScript?

Perhaps the most important language to compare PHP to is JavaScript. Modern development requires that every project uses at least a little bit of JavaScript for client-side development and interactivity. With Node, it has became relatively easy to use JS on the server as well. The idea of using the same language “isomorphically” on the client and the server is very appealing.

Like PHP, JavaScript is an eclectic and sometimes ugly language with a lot of warts and “gotchas”. But JavaScript has gotten hugely fast in the last decade, so the case for it is real. Why pick PHP over JavaScript? You’ve got expertise or need to use libraries in PHP. Otherwise, I think JavaScript may be a better choice.

PHP vs Active Server Pages ((.Net) Core)

Active Server Pages started life as a closed-source Microsoft language for web programming. It was pretty directly comparable to PHP, but ran in Windows Server environments. That was replaced by ASP.net. Which has now been replaced by ASP.NET Core. The latter two are now open-source languages, like PHP is. And I’ve personally never written a lick of ASP, in any variation.

I would favor ASP if I used and loved Microsoft servers. Otherwise, give me PHP please. The size and scale of communities are not really comparable.

Should I Use Ruby or PHP?

Ruby, specifically Ruby on Rails, was very popular a decade ago. Ruby is still a much-loved language, which is much more elegant than PHP to my eyes. That said, its community is smaller. And I sense that Ruby has stopped being the “hot language” (being superseded in that role by JavaScript). Ruby’s beautiful, and there are enough people good at it that I’d not avoid it for that reason. But hiring people already-familiar will remain harder than doing so in PHP. (Though I think the skill of an average Ruby developer is likely higher than the same for PHP.)

Python vs PHP: Which is Better?

The last language that makes sense in a one-to-one comparison with PHP  is Python. Python is used in many more contexts than web development (it’s also very popular for statistics and data analytics). It’s also one of the more stable and well-designed languages around, in popular consensus.

Python (like Ruby, and JavaScript) is a little bit harder to get running on a web server than PHP. But it’s a prettier language, and more diversely used than PHP. It’s one of the languages I’d think hard about favoring over PHP, all other things (access to external library, access to hiring expertise, etc) being equal.

PHP vs Go? Scala? Java? etc?

I mentioned at the top that there was a lot of similarities with all prior direct language comparisons I made. But if we drop those constraints, there are tons of other languages we could compare. So to briefly touch on a few:

  • Java is hugely popular, and very fast. It’s used for building Android apps, desktop apps, and web apps. It’s not dynamically typed though, which has better performance guarantees, but worse ease of web programming.
  • Go is a newer and growing Google-backed language. It’s focused on web servers, but slightly lower-level (more like C) than PHP. It’s fast, but the community of practice is smaller.
  • Scala is a popular JVM-running (Java-compatible) language that still seems to be growing in popularity. It’s more elegantly designed than PHP, but I can’t say much else about it with confidence.

Again, that’s all I feel like I’ve got enough context to touch. But there are even more options you can consider. But that’s the end of the specific alternatives I’ll consider to PHP.

Programming Language Choice is About Context

Given those comparisons, why use PHP? I’ve enumerated some of the things that are bad about PHP, and I feel some of them regularly. Needle and haystack inconsistency in search functions bites me at least once a month when I’m quickly doing something without autocomplete.

For a true and complete greenfield project, with no need to interoperate with any other system, or need to run in any arbitrary environment, with no existing expertise on the team, I’d think pretty deeply before I recommended PHP. Python really appeals to me in that scenario. But those are a lot of caveats. There are great reasons for even a fresh greenfield project to be written in PHP.

Any modern web language can help you make good websites and apps. And every one of them has features that aren’t ideal. PHP, like any of them, requires you to truly understand its trade-offs for you in your project to determine whether or not it makes sense for you. But for me, personally, I continue to find that it’s possible to be — as Keith Adams put it in a great talk — “shockingly productive in PHP.”

If you’ve got a team of Python programmers, write your application in Python. If you’ve got a cofounder who knows Java, write your SaaS in that. The personnel considerations of software should always outweigh the languages ones.


20 thoughts on “Why Use PHP in 2019?

  1. Thanks for the explanation. I decided to take up PHP as a new language this year. Based on what you have written, seems like it is quite easy to learn PHP, especially when I recently set up my own WordPress blog.

  2. Joey says:

    Number 1 result on Google, and it boils down for me to: “It has a large community.”

    All the other reasons are just nonsensical rationalizations to the fact that thousands of developers keep using a language that’s inferior by design and execution.

    • David says:

      I think there’s a little more to the argument than that. But I wouldn’t argue that PHP (or JavaScript) are “more beautifully designed and executed” as languages than Ruby or Python. Partly because I don’t fully believe that, partly because it’s too big an argument to make.

      I touched a little more about why both PHP and JavaScript have succeeded, despite inelegant designs in “All Programs Have a Surrounding Human Context”.

  3. Rayan says:

    For me, what’s make our life much easier, it’s the best, ignore all the bad reputation about php, it’s sufficient, to the point, and fast development, that set we don’t need any thing else, just pick it and start enjoying but try to be professional I mean write good code, nice and clear structure, don’t use the flexibility of the language in crappy code.

  4. Oscar says:

    I have programmed before mostly using VB products from Microsoft, experience with C and C++, some Java, and Front End Development. I’ve never developed any Web sites before but would like to begin. Having PHP, Python, NodeJS, as possible options, which way would you recommend to create a site which must hold sensitive data, something like SalesForce, for example (not that big, I’m just referring to the type of data stored).

    Consider either language I’d have to learn from scratch pretty much. I don’t know enough about community, frameworks, etc to make a decision.

    • David says:

      Hi Oscar,

      Much as I love PHP, I’d tell anyone in you shoes to learn Node/JavaScript. If you’re building a wholly-custom application, I think JS is a better base than PHP, because you’ll be able to use the same language on the client (web browser) and web server. That doesn’t mean there aren’t complex differences between those two environments, but at least for you the underlying programming language will be the same in both places.

      Hope that helps,

  5. Hadi Mir says:

    Dear David,
    I don’t think there’s anything on the web quite like what you’ve published here
    I grew up on PHP and JavaScript always feeling like they were weird scripting languages, tho I think you said it… a) they’re not anymore with all the recent software produced around PHP b)software is about community

    Thank You
    You are enlightening 🙂

  6. Eyal Solnik says:


    Pretty great post but there’s one thing I’d like to point out is that ASP.NET can run on Apache and Nginx through Mono although only partially, not all features are implemented and at this point it’s probably not recommended or worth the hassle; however, ASP.NET Core is fully and completely supported on Windows, Linux and macOS. https://docs.microsoft.com/en-us/dotnet/core/about

  7. Gerardo says:

    I’ll take Net Core any day over PHP. It’s fast as hell (so is very good at scaling), it has a very good language (C#), has its own package library NuGet, it’s Open Source, it runs everywhere (Windows, Mac, Linux you name it), and the community is very large.

  8. jerry john says:

    Thanks for sharing this. I’ve been trying to learn a little PHP. Great post for me and people who already use other languages like asp or asp.net and want to explore PHP. This is very helpful. Keep on the great work. I just want to say that there is no need to dive too deep in PHP if you don’t want to. A versatile coder can just pick what they need for a particular scenario.

  9. A very informative post – thank you for sharing, David

    I am an absolute novice to programming with a business background. I am getting a website developed (the developer is using Laravel framework) and would like to educate myself sufficiently in PHP so that I understand how the code works.

    Where do I start (a course, tutorial, etc.)? I would be grateful for your advice.

  10. Shamt says:

    You can host your web application written with ASP.NET Core on linux servers too ! ASP.NET Core has great tooling for free (Visual Studio Community), Backed by C# language (C# 8 is becoming a really great language) and lots of other things and also .NET Core is the most loved framework based on StackOverflow survey !

  11. Softpulse Infotech says:

    How David, I hope you are doing well. You have written a well-detailed article about the use of PHP in 2019. The main advantage of PHP is a wide developer community support. And above all, it fastens up the web development process by a considerable margin.

  12. Nick says:

    “I would favor ASP if I used and loved Microsoft servers.” – .NET Core is cross platform so there is no need for you to use Microsoft servers

  13. Ten Gee says:

    I learned PHP in 2011 in about 2 hours of coaching. Since then I’ve been writing internal and simple external facing web apps in PHP (with either MYSQL or Oracle backend). Previously I’d built systems using Perl CGI. Having learned C and Shell scripting, I found Perl easy to learn, and I found PHP easy to learn.

    I still use PHP because it is for me the quickest way to cobble together a working web site.

    I have also used JSP/Java and I have to say I find I am having to a LOT more coding to get the same result as with PHP.

    I like the simplicity of the setup, developing on XAMPP (Windows) and deploying to Apache on Linux or Windows. I am getting concerned about being forced down the road of package management via Compose. I do avoid that. I also avoid frameworks like Lavarel etc as it just seems to be like dumbing down the development process, whilst at the same time complicated it by having to learn another set of commands.

Leave a Reply

Your email address will not be published.