replace all occurrence char in string php code example Example: replace all occurrence char in string php $string = str_replace('search','replace',$string);