note 51687 rejected from function.include by betz
| From: | betz@php.net | Date: | Thu, 07 Apr 2005 15:38:58 +0000 |
| Subject: | note 51687 rejected from function.include by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87663@lists.php.net to get a copy of this message | ||
Note Submitter: me at kromefx dot com
----
it seems that fread'ing a file, buffering the content, and eval'ing the content is faster
than standard include in all the tests that i've run. Can anyone else verify this or know why i
shouldn't code this way?
<?
$filename='included_file.php';
$handle = fopen ($filename, 'r');
$content = fread ($handle, filesize ($filename));
fclose ($handle);
ob_start();
eval('?>' . $content . '<?');
$content=ob_get_contents();
ob_end_clean();
echo $content;
?>
seems to run faster than:
<?
include('included_file.php');
?>