Custom function, set default argument values to variables
Posted: Wed Dec 10, 2008 5:51 am
Hi everyone
I'm used to creating my own functions, and functions with optional arguments.
But when I try something like this:
I get a Parse error: syntax error, unexpected T_VARIABLE
I guess it's not possible to set the default of an optional argument to a variable value. Is there a way to do what I'm looking for?
Or do I have to explicitly tell the function what the default value is?
Cheers, B
I'm used to creating my own functions, and functions with optional arguments.
But when I try something like this:
Code: Select all
function my_function($arg1=$var1, $arg2=$var2, $arg3=$var3) {
//do stuff
}I guess it's not possible to set the default of an optional argument to a variable value. Is there a way to do what I'm looking for?
Or do I have to explicitly tell the function what the default value is?
Cheers, B