...

View Full Version : How do I set default value of function parameter as today's date?



cartergarth
02-17-2012, 08:52 AM
How do I set default value of function parameter as today's date?

I tried:
function funcName($today=date('Y-m-d')) {do something}

Throws me this error:
Parse error: syntax error, unexpected '(', expecting ')'


Thanks.

djm0219
02-17-2012, 09:44 AM
function funcName($today) {
if (empty($today)) {$today = date('Y-m-d');}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum