3 ms·
Except that without scope inheritance, the "closures" created with create_function are kind of useless, and since functions are created in the global scope and
by thwarted 18y ago
Except that without scope inheritance, the "closures" created with create_function are kind of useless, and since functions are created in the global scope and thus are not garbage collected, creating new ones each time it is called ends up eating a lot of memory. This makes create_function largely useless, I don't know anyone who uses it; it's often better to just define the function globally yourself anyway and avoid the cost of run-time parser invocation, which is the same cost as using eval. In fact, create_function is implemented in terms of eval.
So you get a bunch of drawbacks and none of the real benefits, plus misrepresentation in the documentation.
Which necessitates this patch, which includes syntax changes, of course. This can only, ahem, be better.