optional argument when creating a function
| From: | D A GERM | Date: | Wed, 17 Aug 2005 15:00:41 +0000 |
| Subject: | optional argument when creating a function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-220751@lists.php.net to get a copy of this message | ||
I'm throwing a warning on a function I created. I
thought a & in front of the argument was supposed to
make it optional. Is there something else I need to do
make that argument optional?
<CODE>
//I simplified the code
function doEmail($username, &$link)
{
if (isset($link))
{
print "$link $username";} else {
print "$username";} } doEmail($arg1); doEmail($arg1, $arg2); </CODE> Here is the error: Warning: Missing argument 2 for doemail() in /srv/www/htdocs/test-a/staff/email_scramble.php on line 24 thanks in advance for any help. -- D. Aaron Germ Scarborough Library, Shepherd University (304) 876-5423 "Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for" (Peter, Family Guy)