Re[2]: [PHP] using eval

From: Date: Fri, 14 Dec 2001 07:20:27 +0000
Subject: Re[2]: [PHP] using eval
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77705@lists.php.net to get a copy of this message
I am trying to get it to fill in the $path variable with what is in $path. It seams eval does not work for this and it does not work on it's own. What can I do to make this work $path="/home/sites/home"; $fp3=fopen ("location.inc","w")or die("unable to open file (location.inc)"); $str='<?'; fwrite($fp3,"$str \n"); $str='include("$path/inc/dataconf.inc");'; fwrite($fp3,"$str \n"); $str='include("$path/inc/lang.eng.inc");'; fwrite($fp3,"$str \n"); $str='include("$path/inc/function2.inc");'; fwrite($fp3,"$str \n"); MT> this is what the eval() command equates to MT> $str = "include("$path/inc/dataconf.inc");"; MT> that should make it clearer (??) MT> -----Original Message----- MT> From: rdkurth@starband.net [mailto:rdkurth@starband.net] MT> Sent: Friday, December 14, 2001 4:21 PM MT> To: php-general MT> Subject: [PHP] using eval MT> I keep getting this error when I use eval what am I missing MT> Parse error: parse error in c:\httpd\doc\install.php(6) : eval()'d code on MT> line 1 MT> $path="/home/sites/home"; MT> $fp3=fopen ("location.inc","w")or die("unable to open file MT> (location.inc)"); MT> $str='include("$path/inc/dataconf.inc");'; MT> eval ("\$str = \"$str\";"); MT> fwrite($fp3,"$str \n"); -- Best regards, rdkurth mailto:rdkurth@starband.net

« previous php.general (#77705) next »