by jonny383 · 6y ago · 0 comments
T|null
In PHP 7, you can still do function foo(string $bar = null): void
Which is a little clunky... function foo(?string $bar): void
Having `= null` marks the parameter as optional with the default being `null`. Using `?string` means there is no default and you can pass in either a string or null. function add(string $a, string$b){}
function add(int $a, int $b){}