이 함수는 haystack의 needle을 주어진 str로 바꾼다. (This function replaces all occurences of needle in haystack with the given str.) 만약 복잡한 치환 룰이 필요하지 않다면, ereg_replace() 대신 이 함수를 사용하여도 된다.
이 함수는 binary safe.
참고: str_replace()는 PHP 3.0.6,에서 추가되었지만, PHP 3.0.8 에 버그가 수정되었다.
ereg_replace() 그리고 strtr()을 참고하라.