Re: Optional Vars in Functions
| From: | Eugene Lee | Date: | Fri, 02 Jan 2004 21:44:48 +0000 |
| Subject: | Re: Optional Vars in Functions | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173654@lists.php.net to get a copy of this message | ||
On Fri, Jan 02, 2004 at 01:20:50PM -0800, Chris wrote:
: Jason Williard asked:
: >
: > Is there a way to make a variable of a function optional?
:
: http://www.php.net/functions
More specifically:
http://www.php.net/manual/en/functions.arguments.php
e.g.
function puke ($stuff = "hairball")
{
echo "puking ".$stuff."\n";
return;
}
puke("beer"); // echoes "puking beer"
puke(); // echoes "puking hairball"