> Hi, I'm about to make a function with two arguments, and I 
> want the second one to be optional. Can I just write the function 
> and use it with one or two arguments without problems (I check 
> if the second argument was passed inside the function).
> Is this OK?

To make the second argument optional, you should declare the
function as such:

function myFunc( $firstArgument, $secondArgument = "" ) {
}

The above is defaulting the second argument to nothing/null/no value.
You could default to any value you wish.  If the argument is not passed,
the default value will be used, whatever it is set to.

Chris

Reply via email to