Hi there ho there, this is probably going to be an easy one for you scripters.
I’m using functions in my pages and some of them have default values. However when I call the function (filling certain values but not others), php returns an error (saying it encountered unexpected ‘,’ or something).
This should be easier to understand:
function anything($a,$b = 2,$c = 3, $d = 4){
return ($a + $b + $c + $d);
}
//returns 10
echo anything(1);
//returns 16
echo anything(1,3,5,7);
//returns a friggin error
echo anything(1,,,7);
How can I tell PHP that I want these two values to be the default ones declared in the function ?
cheers
matt