Re: how do i give optional arguments to functions??

From: Date: Wed, 24 Oct 2001 17:41:09 +0000
Subject: Re: how do i give optional arguments to functions??
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-72132@lists.php.net to get a copy of this message
> 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

« previous php.general (#72132) next »