> Okay here is the situation. I am reading a file using fgets up until I hit a certain delimiter within the text. No problem there. This text file may or may not > contain php in the format <? blah ?>. So I now have two variables $header and $footer which may or may not contain some php within them. I need to echo > the variables at the top and bottom of other files but need any php that may be in there to execute. > > I tried echo(eval($header)) > > and I also tried > > $header = addslashes($header); > eval("\$header = \"$header\";"); > $header= stripslashes($header); > echo($header); > > The first produces and error, the second produces no error however only variables evaluate while actual commands, such as echo just get written into the > code. > > Any idea what I may be doing wrong here?
Try this, it's from a template parsing function I wrote: $header = str_replace("\\'","'",addslashes($header)); eval("\$header = \"$header\";"); Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]