JasonDFR
02-07-2009, 03:06 PM
What is the best way to assign default arguments to function variables when the default is taken from the value of another function.
Example:
function function($startDate = time()) {
echo $startDate;
}
function();
I would like to do the above, but it does not work.
Do you have to test for $startDate inside the function and then set it to time() if it is null? Or is there a better way?
Thanks.
Example:
function function($startDate = time()) {
echo $startDate;
}
function();
I would like to do the above, but it does not work.
Do you have to test for $startDate inside the function and then set it to time() if it is null? Or is there a better way?
Thanks.