3 ms·
In PHP 7 the correct code should be function foo(?string $bar): void Having `= null` marks the parameter as optional with the default being `null`. Using
by EspadaV9 7y ago
In PHP 7 the correct code should be
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.
- jonny383 7y agoYes thanks. A little rusty on the old PHP knowledge off the top of my head.