- preg_filter: documentation ( source)
<?php
$string = "The Chernobyl disaster was a catastrophic nuclear accident that occurred on 26 April 1986, in the No. 4 nuclear reactor at the Chernobyl Nuclear Power Plant, near the city of Pripyat, in the north of the Ukrainian SSR.";
$pattern = '%[A-Z]\w+%';
$replacement = "****";
$newString = preg_filter($pattern, $replacement, $string);
print($newString);