On Mon, 2011-05-02 at 18:28 -0400, Ron Piggott wrote:

> On Mon, May 2, 2011 at 3:16 PM, Ron Piggott <ron.pigg...@actsministries.org> 
> wrote:
> 
> 
>   Is it possible to write a function with an optional flag?  What would the 
> syntax look like?
> 
>   So far I have:
> 
>   function load_advertisement( $web_page_reference , 
> $web_advertising_sizes_reference ) {
> 
> 
> 
> Hi Ron:
> 
> I'm not sure what you mean by "optional flag"? Do you mean an optional 
> parameter?
> 
> Richard 
> 
> 
> Correct Richard.  Ron


function load_advertisement( $web_page_reference ,
$web_advertising_sizes_reference=default_value)

This sets a default value for a parameter, which you can check for
within the function itself and use it if it differs from what you set.
Set it to something that it shouldn't be, like null or something.

Also note that these parameters have to occur after any that don't have
a default value

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk


Reply via email to