problem with eval()
| From: | Alan Gillespie | Date: | Fri, 14 Jul 2000 03:59:49 +0000 |
| Subject: | problem with eval() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-6593@lists.php.net to get a copy of this message | ||
hi all,
this is my first posting, so if it's not quite right
excuse my
I have an 'application' which parses a given file,
which contains HTML & PHP3. For the HTML lines the
application writes the line to Dest_File.
For the PHP3 lines it's suppossed to interpret these
using the eval() statement, and depending on the PHP3
different text would be written out to the Dest_File.
except that doesn't work.
here's my code
(the contents of $complete_code has been read from
SRC_FILE)
$complete_code='if ($value == $today) echo "Hello
World";';
$temp_string = addslashes($complete_code);
eval("\new_string=\"$complete_code\";");
The value of $new_string is then:
if (1 == 1) echo "Hello World";
instead of "Hello World" or ""
any help on this would be very much appreciated.
thanks in advance,
alan
http://www.ireckon.com