Re: how do i give optional arguments to functions??
| From: | Tamas Arpad | Date: | Wed, 24 Oct 2001 17:45:41 +0000 |
| Subject: | Re: how do i give optional arguments to functions?? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72129@lists.php.net to get a copy of this message | ||
On Wednesday 24 October 2001 19:26, Richard S. Crawford wrote:
> Hm, is the default attribute necessary? I've used this sort of
> approach without the default attribute just fine in the past.
> Though I admit that the default attribute would make me feel more
> secure.
Not really necessary, but I like to make code without any warning
message (it also makes the code more cleaner as you said), and you'll
get a warning message if there's no parameter given at the function
call (without the default value).
Arpi
>
> At 10:30 AM 10/24/2001, Arpad Tamas wrote:
> >On Wednesday 24 October 2001 19:14, Richard S. Crawford wrote:
> >
> >The default value for $image parameter was missing:
> > > function top ($image="defaultvalue") {
> > > if ($image=="defaultvalue") echo "blah blah blah";
> > > else echo "blah blah $image blah";
> > > }
> >
> > Arpi