- preg_replace_callback: documentation ( source)
- mb_strlen: documentation ( source)
- str_repeat: documentation ( source)
<?php
$string = 'blahblah<del>blahblah</del>blahblah';
echo preg_replace_callback('~<del>(.*?)</del>~', function($match) {
$replace = str_repeat(' ', mb_strlen($match[1]));
return $replace;
}, $string);