Answers for "send parameter to function in php can null"

PHP
0

send parameter to function in php can null

function foo(?Type $t) {
}
this will result in

$this->foo(new Type()); // ok
$this->foo(null); // ok
$this->foo(); // error
Posted by: Guest on October-02-2021

Code answers related to "send parameter to function in php can null"

Browse Popular Code Answers by Language