On Thu, Dec 22, 2011 at 10:53 AM, Daniel Barrett <danb(a)vistaprint.com>wrote;wrote:
Brion Vibber wrote:
My recommendation under ideal circumstances would
be to use closures
(needs
PHP 5.3) to wrap a parameter to your real
callback; on older versions you
could use create_function which is ugly, but probably not much worse for
performance.
Thanks Brion. I have switched from create_function (our old
implementation) to closures and it's certainly less ugly now. I still wish
I could create only the single callback needed, instead of 70 callbacks
every single time one tag is used, but I don't have actual measurements to
know if this is a noticeable performance drag. It just offends the computer
scientist in me. :-)
:D
Well, the way to do just one is to use the __call or __callStatic magic
like in HappyMelon's recommendation -- that way you don't actually have to
make 70 methods, you only need to make one and the other part of the system
*thinks* you have 70 methods. ;)
-- brion