...

View Full Version : Optonal Values in Functions



srule_
01-04-2008, 09:07 PM
How do you make optional values in user defined functions? Is it via if statements?

ex: function example(valueHere, optionalValueHere).

dumpfi
01-04-2008, 09:39 PM
function example($value, $optionalValue = 7)
{
return $value + $optionalValue;
}

example(3); // 10
example(3, 6); // 9
dumpfi



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum