PHP in 2020 it's not your mama's PHP

 Date: February 19, 2020

I decided to write this post, because before joining Facebook I thought that PHP is just old, limited language from 2 decades ago when server was responsible for simple form parsing, and generating HTML.

I actually learned web development using PHP in mid-2000s, when I was in middle school. I created my personal blog, and website about very popular back then game Deluxe Ski Jump. I actually still have the source code and recently put it on Azure. Didn't bother to update character encoding from ISO-8859-2 to UTF. Why I used ISO-8859-2? Because my cousin told me to do so! I was a real copy/paste programmer back then! Good times :D

Mark Zuckerberg wrote the first version of Facebook around that time using PHP too. LAMP stack was the way to go for web development in 2000s.

A few days after joining Facebook I realized that PHP now is a full-blown OO language. It has classes, interfaces, abstract classes, dependency injection, etc. It is much closer to C# or Java than to PHP that I used to write 15 years ago.

At facebook we use Hack (typed PHP). It's awesome. You have the best of two Worlds: type safety and no compilation! Just save, and refresh to see your changes. Yay! Sample Hack/PHP code:

  class Foo {
    public function getFullName(string $firstName, string $lastName): string {
      return $firstName . " " . $lastName;

    public async function genImage(string $uri): Awaitable<?Image> {
      $format = "jpg";
      if (!Vec\contains($this->allowedFormats, $format)) {
        return null;

      $img = await $this->genImageInFormat($uri, $format);
      return $img;

    private static allowedFormats = vec["jpg", "png"];

    private async function genImageInFormat(string $uri, string $format): Awaitable<Image> {
      // ...

As pure PHP performance is not the best, HHVM performance is an improvement.

In PHP, you can access pretty much every module in the codebase without explicitly referencing it. That's an extra productivity boost. Or hack:) Intellisense in editors like Nuclide (Atom) or VSCode is pretty good as well. When you add Facebook engineering systems, where everything is so neatly setup to prioritize productivity, you are in heaven :) I know most of PHP devs do not have that luxury, but just sayin' ;)

If you want to learn more about modern PHP, check out these resources:

As of February 2020, PHP is 5th most popular language on StackOverflow (source)! Just recently taken over by python.

In any means I am not recommending you to learn PHP if you don't have to. Choose Rust or Go instead! Just wanted to let you know, that PHP changed A LOT! PHP in 2020 is not PHP from Web 1.0 times.

 Tags:  programming

⏪ Hello, Startup - 360 overview of running tech business

Future of Package Delivery is Underground ⏩