July 13th, 2000, 07:48 PM
my problem is with eval.
I have in a "parse_me.html" file, a mix of HTML & PHP3. The PHP3 code in the "parse_me.html" file is very basic.
Using my 'application', I read through the "parse_me.html" file copying the HTML line for line, and when it hits PHP3 code it is suppossed to process the code, using the eval() statement.
e.g. sample from "parse_me.html"
<? if ($value == $today)
echo "HELLO WORLD; ?>
...so when my application processes this file, the line with the PHP3 code is stored
$complete_code = 'if ($value == $today) echo "HELLO WORLD";';
eval ("$new_str = "$complete_code";");
the data stored in $new_str is:
if (1 == 0) echo "HELLO WORLD";
instead of "HELLO WORLD".
does anybody have any way of resolving this problem.
many thanks in advance,
July 14th, 2000, 09:33 PM
You can't store commands in strings... so, you'll have to find another way to do what you're trying to do. Also, what is it that you are trying to do? All the eval() does is set the contents of $complete_code (with the current strings parsed) into $new_str. Perhaps you need to escape your variable assessment. I'm not sure I am helping much here, but it's worth a shot.
To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson