I have an anonymous functions that I now need to update to be compatible with PHP 5.2. The function (below) takes text and uppercases the first letter of every sentence.
preg_replace_callback()
as a second argument requires a callable, that is a function itself, not a returned value from a function.
So just replace, upper_case($input)
with upper_case
, so it would look like this
preg_replace_callback('/([.!?])\s*(\w)/', 'upper_case', ucfirst(strtolower($input)));