If I have a function such as
function foo($a, $b = 2, $c = 3)
{
return [$a, $b, $c];
}
Then I can omit passing $b and $c since they have default values. But, say, I want to pass something to $c, but not to $b. How can I do it? Obviously I could swap their places in the declaration (function foo($a, $c = 3, $b = 2), but then I wouldn't be able to only pass $b.
My point is that I want to make a function that has arguments with default values, but which ones I want to pass varies. I tried this: print_r(foo(1, $c = 5)), but it results in [1, 5, 3] not in [1, 2, 5].