note 20595 deleted from function.eval by nlopess
| From: | nlopess@php.net | Date: | Mon, 17 May 2004 18:55:59 +0000 |
| Subject: | note 20595 deleted from function.eval by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69734@lists.php.net to get a copy of this message | ||
Note Submitter: opaf@yahoo.com
----
My external filename (TableStart.htm) contains something like:
<table border=0 width="<?PHP echo $myvar ?>">
Now I had a routine which drew a box arround all my HTML. Of course I couldn't pass all my
variables so I used eval() to declare my variables like this:
Original routine:
<?php
global $myvar;
$string = implode ('', @file('TableStart.html'));
$string = "?>" . $string . "<?PHP ";
DoBox ($string, "\$myvar");
function DoBox($body, $extravars = "") {
if (!empty($extravars))
eval("global ".$extravars.";");
/* draw start of box */
echo "<table><tr><td>";
/* draw the body */
eval($body);
/* draw end of box */
echo "</td></tr></table>";
}
?>
Neat!