string str_replace
This function replaces all occurences of needle in haystack with the given str. If you don't need fancy replacing rules, you should always use this function instead of ereg_replace().
Example 1. str_replace() example
$bodytag = str_replace("%body%", "black", "<body text=%body%>");
This function is binary safe.
See also ereg_replace().