Default argument values for functions

From: Date: Mon, 16 Dec 2002 16:03:44 +0000
Subject: Default argument values for functions
Groups: php.general 
Request: Send a blank email to php-general+get-128412@lists.php.net to get a copy of this message
I want to use the value of a variable that is defined in a text.inc.php file as a default argumant value for a function. $t_email_afzender_rtg It doesn't work !!! I tried it without quotes and with. If I just put a string value in it it works, but that defeats the purpose of my inc.php file! So this is just a theoretical thing ! function htmlemailheaders($from="$t_email_afzender_rtg",$CC="",$BCC="") { $mailheaders = "From: $from\r\n $mailheaders .= "Reply-To: $from\r\n"; if($CC!="") { $mailheaders .= "Cc: $CC\r\n } if($BCC!="") { $mailheaders .= "Bcc: $BCC\r\n"; } $mailheaders .= "MIME-Version: 1.0 \r\n"; $mailheaders .= "Content-type: text/html;charset=us-ascii \r\n"; $mailheaders .= "Content-Transfer-Encoding: 7bit \r\n"; return $mailheaders; }//end function htmlemailheaders()------------------------------------------------- thanks for your help

« previous php.general (#128412) next »