$ ./guess_the_languageProgramming Languages
Programming Languages · medium · #594

Which programming language is this?

function makeUrl(string $host, int $port = 80, bool $tls = false): string {
    return ($tls ? 'https' : 'http') . "://$host:$port";
}

$opts['host'] ??= 'localhost';
echo makeUrl(host: $opts['host'], tls: true);

Answer: PHP

Typed $ parameters, the ??= null-coalescing assignment and named arguments like host: are PHP 8.
Play Programming Languages ▸