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
Play Programming Languages ▸
$ parameters, the ??= null-coalescing assignment and named arguments like host: are PHP 8.