PHP now has support for undefined!?

Before you dismiss this post as some cheap clickbait, please take a look at the following code and tell me if this is PHP:

<?php

function greeting(string $name, string|null|undefined $title = undefined) {
    $greeting = 'Hello';
    $greeting .= match ($title) {
        null => ' ',
        undefined => ' ??? ',
        default => " $title ",
    };
    $greeting .= $name;
    return $greeting;
}

echo greeting('John Doe');

Drumroll… it actually is perfectly valid PHP code.

Continue reading “PHP now has support for undefined!?”