Re: [PHP] feature that should be there and isn't

2001-01-30 Thread Brian White
Let me start by saying "Can of Worms!" At 20:07 30/01/2001 -0800, Joe Stump wrote: >BUT you can't do this: > > function foo($var=date("Y-m-d")) > { > > > } > >Why? This would be a kick ass little trick! The question is: when do you resolves something like this? Is it at "compile time" or

RE: [PHP] feature that should be there and isn't

2001-01-30 Thread Jason Murray
> BUT you can't do this: > > function foo($var=date("Y-m-d")) > { > > > } But, you can do function foo($var='defaultvaluethatwillneverhappen') { if ($var == 'defaultvaluethatwillneverhappen') { $var = date("Y-m-d"); } } > Why? This would be a kick ass little trick! Mmmm, well ...

[PHP] feature that should be there and isn't

2001-01-30 Thread Joe Stump
in php to have a "optional" parameter in a function you can do: function foo($var='') { } To have it be default to 'bar' you can do: function foo($var='bar') { } BUT you can't do this: function foo($var=date("Y-m-d")) { } Why? This would be a kick ass little trick! -