Skip to content
Advertisement

Tag: anonymous-function

Anonymous functions in WordPress hooks

WordPress hooks can be used in two ways: using callback function name and appropriate function using anonymous function (closure) Is there any difference for WordPress what way to use? What is prefered way and why? Answer The disadvantage of the anonymous function is that you’re not able to remove the action with remove_action. Important: To remove a hook, the $function_to_remove

Which version of php added anonymous functions

In manual there is create_function function and you can pass result from that function to array_map, I thought that that is the only way to have something like anonymous functions and closures, but then I found that I can just put function like in javascript In which version of php I can do this? Was this always there? Answer Closures

Advertisement