preg_replace($pattern, $replacement, $subject [, $limit [, &$count]]);
// Returns an array if the subject parameter is an array,
// or a string otherwise.
// If matches are found, the new subject will be returned, otherwise
// subject will be returned unchanged or NULL if an error occurred.
preg_replace($pattern, $replacement, $string);
<!DOCTYPE html>
<html>
<body>
<?php
// Display result after replace and count
echo preg_replace(array('/d/', '/s/'),
'*', '1234567890', 8);
?>
</body>
</html>