eval with php 3.0.16
| From: | Vempyre | Date: | Fri, 28 Jul 2000 20:12:27 +0000 |
| Subject: | eval with php 3.0.16 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8842@lists.php.net to get a copy of this message | ||
I am using these (built with PHP4.0.1pl2) expressions, which I (finally) have been able to have
working on PHP4 :
$pattern = ereg("{{[A-z0-9_]*}}", $var2use[$index]);
if ($pattern)
{
$line = ereg_replace("{{", "$", $var2use[$index]);
$line = ereg_replace("}}", "", $line);
}
else
{
$line = $var2use[$index];
}
$line .= "<BR>";
eval( "\$line = \"$line\";" );
$line = ereg_replace("\|","\'",$line);
$line = stripslashes($line);
but the serevr I must use them on uses php 3.0.16 instead of php 4
in php3 'eval( "\$line = \"$line\";" );' returns a parse error
and the '$pattern = ereg("{{[A-z0-9_]*}}", $var2use[$index]);'
and '$line = ereg_replace("{{", "$", $var2use[$index]);'
and other various regular expressions return a syntax error
all of this code functioned very well in php4, why must I modify to adapt it?
(eval do evaluate some html codes, it's part of a loop wich looks through a template)