[Text_Highlight] eval() Vs call_user_func()...
| From: | Davey | Date: | Thu, 08 Apr 2004 00:08:12 +0000 |
| Subject: | [Text_Highlight] eval() Vs call_user_func()... | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-27147@lists.php.net to get a copy of this message | ||
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".
- Davey