Posted by Joachim Weiί on 08/18/05 00:54
Exyle schrieb:
> I have a function that has two arguents, however depending on the value
> of the first argument, the second one may or may not be needed. If I
> only input the first argument when calling the function, PHP returns a
> warning. many built in php functions have optional arguments, is there a
> way to make arguments in user defined functions optional as well?
>
> Thanks.
You have to give the second argument a default value
function foo($arg1,$arg2=NULL)
then the function can be called without $arg2
hih
Jo
[Back to original message]
|