Skip to content
Advertisement

Refactoring create_function for php 7.2

I need to refactor a piece of php code to work with 7.2 but i am not sure if the way i did it is correct. I could use some info about it. This is the old code

JavaScript

And this is the code i refactored for 7.2

JavaScript

Is it correct or did i mess up ?

Advertisement

Answer

You missed out on the “use” part so the function body does not know about the $field and messed up the $field array keys – see below:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement