RE: [PHP] how do i give optional arguments to functions??

From: Date: Wed, 24 Oct 2001 17:51:14 +0000
Subject: RE: [PHP] how do i give optional arguments to functions??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72134@lists.php.net to get a copy of this message
It could be, but then you would have two spaces in between the 2nd and 3rd "blah", instead of just the one space. But, depending on your actual application, this may work out. -----Original Message----- From: DL Neil [mailto:PHPml@DandE.HomeChoice.co.uk] Sent: Wednesday, October 24, 2001 10:41 AM To: Arpad Tamas; Richard S. Crawford; sunny AT wde; php Subject: Re: [PHP] how do i give optional arguments to functions?? > 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"; > > } If the default value can be set to an empty string can the if statement then be removed? function top ($image="") { echo "blah blah $image blah"; } - watch those spaces (if they're present in live data)! =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#72134) next »