Re: how do i give optional arguments to functions??
| From: | Jason G. | Date: | Thu, 25 Oct 2001 20:14:52 +0000 |
| Subject: | Re: how do i give optional arguments to functions?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72342@lists.php.net to get a copy of this message | ||
Umm...
function top($image = '')
{
echo("bla bla $image bla");
}
Might need to use an IF (because of having 2 spaces if the image is empty)
-Jason Garber
IonZoft.com
At 10:14 AM 10/24/2001 -0700, Richard S. Crawford wrote:
function top ($image) {if ($image) echo "blah blah blah"; else echo "blah blah $image blah";} There's probably a more efficient way to do it. At 09:57 AM 10/24/2001, sunny AT wde wrote:hi all!! i'm writing functions like - ------- function top () { echo "blah blah blah";} ------- what i want to do is make it so that i can do - ------- function top($image) { echo "blah blah $image blah"; } ------- but also make the $image parameter in the top() as optional. so if its not there, then tell php not to worry about it. any ideas?? thanks! sunny __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- 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.netSliante, Richard S. Crawford http://www.mossroot.com mailto:rscrawford@mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- 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