Re: the way create_function works (internally)?
| From: | Stanislav Malyshev | Date: | Wed, 05 Jul 2000 13:02:04 +0000 |
| Subject: | Re: the way create_function works (internally)? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-23564@lists.php.net to get a copy of this message | ||
w>> For any reason I thought functions created with create_function() should
w>> be created faster. I╢ve stressed my server with some performance tests
w>> and the result was that the create_function() created function performed
w>> worse than declaring a function manually...
Surely they are slower. Every create_function is a compiler run. If you
know your function, it's much faster to define it immediately.
w>> If someone could provide an example what create_function() is for (not
w>> how to use it, I already know) and what╢s the advance then declaring a
w>> function directly (typing it)....
For creating functions in run-time (self-generating PHP code :). That's
like eval, only more understandable. You were able to do it via eval long
ago, create_function is just another way.
I have template mechanism based on this idea (every template is a function
returning insantiated result). It's faster then regexps, etc. Creative
mind can find another 1000 ways to use dynamically-created code :)
--
Stanislav Malyshev stas@zend.com
+972-3-6139665