Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

[PHP] problem with eval() From: Alan Gillespie (alan <email protected>)
Date: 07/13/00

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>