Hello,
You just need to use this code:
$str = preg_replace_callback(
                        '/>(\s*$\s*)</m',
                        create_function('$matches', "return strpos('$matches[0]', ' ') === false?'><':'> <';"),
                        $str
                        );
instead of the deprecated sentence.
Regards.