Re: [Text_Highlight] eval() Vs call_user_func()...
| From: | Justin Patrin | Date: | Thu, 08 Apr 2004 00:11:21 +0000 |
| Subject: | Re: [Text_Highlight] eval() Vs call_user_func()... | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-27149@lists.php.net to get a copy of this message | ||
Davey wrote:
Hey, I've been doing some tests after a comment on using eval() in Text_Highlight I went and modified it to use call_user_func(). Afterwards I decided to benchmark it using Benchmark_Iterate, and have come up with the following surprising results: Using call_user_func(): array(2) { ["mean"]=> string(8) "0.027010" ["iterations"]=> int(1000) } Using eval(): array(2) { ["mean"]=> string(8) "0.026098" ["iterations"]=> int(1000) } Surprising to me. Not enough to cause any reason to choose one over the other.... and I've chosen call_user_func() because I'm from the school of "if eval() is the answer, you're asking the wrong question". - DaveyWhy not use indirection instead? $funcName = 'functionToCall'; $funcName(1, 2, 3); -- paperCrane <Justin Patrin>