Re: Custom function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In my code, I set the optional parameter to NULL and check for triple equals "===" or "!==" to see if the variable has been passed with a value. IMO, this is the safest way.

function MyFunction($x, $y, $z=NULL) {
if ($z !== NULL) {
// Do Something
}
}

Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.


On 2-15-2011 6:32 PM, Ron Piggott wrote:
Is there a way to make an optional flag in a custom function --- 2 parameters required, 1 optional?  Ron

The Verse of the Day
âEncouragement from Godâs Wordâ
http://www.TheVerseOfTheDay.info


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux