> Much better to use a *function* which is parsed once
> then include()ing or eval()ing the same code over and over to (possibly) be
> re-parsed.


//I read file once:
$handle = fopen($fileName, "r");
$script = 'function use_cached_code(){
?>';
$script. = fread($handle, filesize($fileName));
$script. = '<?php
}';

//parse it once:
eval($script);

//and use the code as much as I want:
use_cached_code();

> It just makes more sense code structure-wise as well.

Not in my case, believe me. Otherwise I would not ask about caching.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to