php-general Digest 7 Jan 2012 17:26:22 -0000 Issue 7639
Topics (messages 316208 through 316210):
Re: Non required argument
316208 by: Simon J Welsh
316209 by: Donovan Brooke
316210 by: Donovan Brooke
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On 7/01/2012, at 2:13 PM, Donovan Brooke wrote:
> Hello,
>
> I have a simple function that contains an argument that is not required, ie:
>
> function list_formvars($pmatch) {...
>
>
> However, if I call the function without the argument, I get a warning (I'm
> having the app show all warnings for development):
>
> "Warning: Missing argument 1 for list_formvars(), called in ..."
>
> Though the function works fine, how would I go about then making argument not
> required. I've tried using an if statement with an isset() condition, but
> perhaps I don't have the syntax correct?
>
> Anyway,
> TIA for your comments.
>
> Donovan
>
>
>
>
> --
> D Brooke
function list_formvars($pmatch=null) {...
http://php.net/manual/en/functions.arguments.php#functions.arguments.default
---
Simon Welsh
Admin of http://simon.geek.nz/
--- End Message ---
--- Begin Message ---
function list_formvars($pmatch="value") {... }
thanks to Tolga.
Donovan
--
D Brooke
--- End Message ---
--- Begin Message ---
Simon J Welsh wrote:
[snip]
function list_formvars($pmatch=null) {...
http://php.net/manual/en/functions.arguments.php#functions.arguments.default
Thanks!.. missed that doc somehow.
Donovan
--
D Brooke
--- End Message ---