Re: Mixing eval() with include/require
| From: | Mark Rogers | Date: | Fri, 22 Dec 2000 09:30:52 +0000 |
| Subject: | Re: Mixing eval() with include/require | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31555@lists.php.net to get a copy of this message | ||
Tim Zickus wrote:
> I would try something like:
>
> $expr = implode(" ",file("test$id.inc"));
>
> and in your loop, do "eval($expr)".
>
> This way it only gets included once.
Thanks for this suggestion; I'll experiment along these lines when I get
chance.
What overhead is there for the eval()? Eg, what difference would there be
between:
MyFunc();
and
eval('MyFunc();');
Note that the function is being called repeatedly in a loop so small
differences can mount up. As long as it's insignificant compared with the
time taken by MyFunc() itself I'll be okay.