You can also go by:
$str = 'This is a string with an email_test@domain.co.uk with some more text.';
echo $str . '<br />'; // to simply output the current string before any replacement...
$str = preg_replace('#[^\x20]+@[^\x20]+#', '*', $str);
echo $str; // ouput new version without email listed...
output:
This is a string with an email_test@domain.co.uk with some more text.
This is a string with an * with some more text.
Come to think of it, best to use the \s instead of \x20. This way, ANY spacing will not be allowed.
preg_replace('#[^\s]+@[^\s]+#', '*', $str);