Any way to specify optional parameter values in PHP?
2022-08-30 17:23:22
Let's say I've got a PHP function foo:
function foo($firstName = 'john', $lastName = 'doe') {
echo $firstName . " " . $lastName;
}
// foo(); --> john doe
Is there any way to specify only the second optional parameter?
Example:
foo($lastName='smith'); // output: john smith