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

From: Date: Wed, 24 Oct 2001 17:41:54 +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-72130@lists.php.net to get a copy of this message
Check out the manual section on default parameters... But the basics are: function top($image = "null") { if ($image) ... else ... } Or maybe: That will set image to be null, so that you can call top either as: top(); or top($someimage); -----Original Message----- From: sunny AT wde [mailto:sandeep_wde@yahoo.com] Sent: Wednesday, October 24, 2001 9:58 AM To: php Subject: [PHP] how do i give optional arguments to functions?? 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.net

« previous php.general (#72130) next »