how do I use "<" and "<" with eval()?
| From: | John A. Grant | Date: | Wed, 31 Oct 2001 22:51:36 +0000 |
| Subject: | how do I use "<" and "<" with eval()? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-73087@lists.php.net to get a copy of this message | ||
I'm not having an easy time understanding the discussion
in the doc for eval().
I want to read this string from a file:
xxx <?php somefunc("yyy",3); ?> zzz
and then "run" it.
I tried this code:
<?php
function somefunc($text,$n)
{
for($i=0;$i<$n;$i++){
echo $text;
}
}
$string='xxx <?php somefunc("yyy",3); ?> zzz';
eval($string);
?>
but I get
"Parse error: parse error in eval.php(11) : eval()'d code on line 1
Do I have to use < and > in place of "<" & ">"? I tried
several combinations, but I still get the same error.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here