I was wondering if there is a simpler way that I can use a php inbuilt function as the default value for a function.
Here's my current code:
function custom_date($format = 'm-d-Y', $time = null)
{
if($format == "d-m-Y") {
// do something with $time
}
return date($format, $time);
}
I want to use time() as a default argument for $time instead of null, but it will not let me. I know I can pass time() as a 2nd argument to custom_date everywhere its called, but it's used at many places without 2nd argument and changing it would be a pain.