I am usingcreate_function()
in the application below.
$callbacks[$delimiter] = create_function('$matches', "return '$delimiter' . strtolower($matches[1]);");
But as of PHP 7.2.0,create_function()
is deprecated.
How to rewrite the above code for PHP 7.2.0?
I would like to contribute a very simple case I found in a WordPress theme and it seems to work fine:
Has the followingadd_filterstatement:
Replace it with:
We can see the usage of function(), which is a very typical function creation, instead of using the deprecated create_function() to create a function.
You should be able to useanonymous functions(aka closures) calls to parent scope
$delimiter
variables like this: