Prev: Include security?
Next: solution
From: Micky Hulse on 18 Apr 2010 15:43 On Sun, Apr 18, 2010 at 10:23 AM, Michiel Sikma <michiel(a)thingmajig.org> wrote: > I would prefer to use include() since it runs the code in the same context, > ...<snip>... > with your data rather than printing it right away. Thanks for the reply Michiel, I really appreciate it. :) For some benchmarks on the different types of inclusion functions/language constructs, this page has some good info: <http://www.raditha.com/wiki/Readfile_vs_include> The results are interesting. Thanks again! Have an excellent day. Cheers, Micky
From: Michiel Sikma on 19 Apr 2010 06:02 On 18 April 2010 21:43, Micky Hulse <mickyhulse.lists(a)gmail.com> wrote: > On Sun, Apr 18, 2010 at 10:23 AM, Michiel Sikma <michiel(a)thingmajig.org> > wrote: > > I would prefer to use include() since it runs the code in the same > context, > > ...<snip>... > > with your data rather than printing it right away. > > Thanks for the reply Michiel, I really appreciate it. :) > > For some benchmarks on the different types of inclusion > functions/language constructs, this page has some good info: > > <http://www.raditha.com/wiki/Readfile_vs_include> > > The results are interesting. > > One thing to keep in mind is that this one doesn't take eval() vs regular include execution time into account, in case you were still considering using it. According to this page, it's many times slower: http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/ Michiel
From: Micky Hulse on 19 Apr 2010 12:29
Hi Michiel! > One thing to keep in mind is that this one doesn't take eval() vs regular > include execution time into account, in case you were still considering > using it. According to this page, it's many times I was still considering it... I mean, I am still exploring all my options for the sake of the learning/coding experience. > slower:Â http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/ Oh! Nice! [[ The speed of eval Besides security concerns eval also has the problem of being incredibly slow. In my testing on PHP 4.3.10 its 10 times slower then normal code and 28 times slower on PHP 5.1 beta1. This means if you have to use eval, you should avoid using it inline in any performance sensitive code. Any easy way to cancel the performance penality is to create a function in eval and just call that, now an extra function call does have some performance overhead but its pretty small and depending on the design can be non-existant since you would be calling some function anyway. ]] Interesting. Great read. Thanks for linkage. [ot] The article also mentions variable functions... I have never used those before. They look very useful, esp. for a function callback. Learn something new every day! :) [/ot] Thanks again for you help Michiel! I really appreciate it. :) Have a great day! Cheers, Micky |