note 48381 deleted from function.eval by tularis
| From: | tularis@php.net | Date: | Tue, 21 Dec 2004 16:02:26 +0000 |
| Subject: | note 48381 deleted from function.eval by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82133@lists.php.net to get a copy of this message | ||
Note Submitter: arnico at c4 dot lv
----
And there is update for last post.
Now html can be at start or end of file. and php only in midle.
<?php
# arnico page loader v 1.2;
function eval_html($string) {
$string = preg_replace("/(\?>)(.*?)(<\?php|<\?)/si", "echo
\"\\2\";",$string);
$string = preg_replace("/(.*?)(<\?php|<\?)/si","echo
\"\\1\";",$string);
$string = preg_replace("/(\?>)(.*$)/si","echo
\"\\2\";",$string);
return eval($string);
}
$filename = "test.php";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
echo eval_html($contents);
?>
----
Reason: useless example