有条件的查找和替换php函数

I have this function which searches for strings like this:

<unique>342342342</unique>
<unique>5345345345345435345</unique>
<unique>4444</unique>

function:

$pattern = '/<unique>(.*?)<\/unique>/';
$response = preg_replace_callback($pattern,function($match){
    $value = intval(trim($match[1])/200);
    return '<unique>'.$value.'</unique>';
},$xml);

and change the number to its half (n/2). So far so good.

But I need to add a conditional to check if the number has more than 10 digits, if true then makes the change, if not, doesn't.

I tried this, but nope...all instances de '4444' get removed

$pattern = '/<unique>(.*?)<\/unique>/';
$response = preg_replace_callback($pattern,function($match){

        $valueunique = trim($match[1]);
        if(strlen($valueunique) >= 11){
            $value = intval($valueunique/200);
            return '<unique>'.$value.'</unique>';
            }
},$xml);

Just move the return outside the if block:

$xml = '<unique>342342342</unique>
<unique>5345345345345435345</unique>
<unique>4444</unique>';

$pattern = '/<unique>(.*?)<\/unique>/';
$response = preg_replace_callback($pattern,function($match){
        $value = trim($match[1]);
        if(strlen($value) >= 11){
            $value = intval($value/200);
        }
        return '<unique>'.$value.'</unique>';
},$xml);

echo "response = $response
";

Output:

response = <unique>342342342</unique>
<unique>26726726726727180</unique>
<unique>4444</unique>