24
The way you want: no.
You could use some special mark, like NULL to note that value is not supplied:
function foo($firstName, $lastName = 'doe') {
if (is_null($firstName))
$firstName = 'john';
echo $firstName . " " . $lastName;
}
foo(null, 'smith');
No there isn't but you could use an array:
function foo ($nameArray) {
// Work out which values are missing?
echo $nameArray['firstName'] . " " . $nameArray['lastName'];
}
foo(array('lastName'=>'smith'));