开发者

How did/do PHP's "higher order" (callback) functions work prior to version 5.3?

For exa开发者_运维问答mple, the array_map function. You pass it a string which is the name of a function. Presumably it doesn't directly eval the string, since you get a specific error:

PHP Warning:  array_map() expects parameter 1 to be a valid callback, function 'dfdgdfg' not found or invalid function name

Which is different from the "Call to undefined function" error that you get if you call an undefined function.

So, is it looking up your string in the global symbol table, checking if it exists, and if not, throwing the above exception?

That still doesn't explain how it's calling the function though. Is it doing an eval on the string after checking if it's a defined function?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜