null as returntype php code example
Example: php 7.1 functions parameters with "?"
function sayHello(?string $name) {
echo "Hello " . $name . PHP_EOL;
}
sayHello(null); // Hello
sayHello("John"); //Hello John
function sayHello(?string $name) {
echo "Hello " . $name . PHP_EOL;
}
sayHello(null); // Hello
sayHello("John"); //Hello John