splite and replace code
Posted: Thu Sep 04, 2008 12:26 pm
hello i try to split and replace a mysql result
i have one form to store data and one field called description
in this textarea (description) i write
-----------------
hello all this is a text <code> ?> $4 = 2+2; echo "$4"; <?</code>
------------------
okay now i want to execute the code but ooooonly from <code> to </code>
to use as folowing
$description = $row->description; // hello all this is a text
and
$description = eval($row->description); // 4
echo $description;
any good idea ?
i thin something that
$description .= preg_replace("[<code>]", " "; echo eval( ", $row->description);
$description .= preg_replace("[</code>]", " ); ", $row->description);
echo $description;
but not working
i have one form to store data and one field called description
in this textarea (description) i write
-----------------
hello all this is a text <code> ?> $4 = 2+2; echo "$4"; <?</code>
------------------
okay now i want to execute the code but ooooonly from <code> to </code>
to use as folowing
$description = $row->description; // hello all this is a text
and
$description = eval($row->description); // 4
echo $description;
any good idea ?
i thin something that
$description .= preg_replace("[<code>]", " "; echo eval( ", $row->description);
$description .= preg_replace("[</code>]", " ); ", $row->description);
echo $description;
but not working