RE: [PHP] Understanding code.. again
| From: | Jeff McKeon | Date: | Thu, 25 Sep 2003 20:10:30 +0000 |
| Subject: | RE: [PHP] Understanding code.. again | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163988@lists.php.net to get a copy of this message | ||
Ok, so if an argument is supplied to the function, the "= null" is
ignored?
Jeff
> -----Original Message-----
> From: Brad Pauly [mailto:brad@robinsontech.com]
> Sent: Thursday, September 25, 2003 4:09 PM
> To: Jeff McKeon
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Understanding code.. again
>
>
> Jeff McKeon wrote:
> > Function Showmessage($msgvar = null)
> > {
> > echo $msgvar;
> > }
> > ?>
> > --snip--
> >
> > What is the purpose in the function def of "($msgvar =
> null)"?? Why
> > not just "function showmessage($msgvar)"??
>
> That sets a default value for $msgvar so you can call the function
> without an argument and it will not raise an error.
>
> - Brad
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>