php str_replace not works <p>I have a html code putted in a variable. I want to replace any relative image src to absolute aby using str_replace. like this:</p> <pre><code>$export = 'some html codes' $repthis = 'src="/images'; $reptothis = 'src="http://images.site.com'; $export = str_replace($repthis, $reptothis, $export); </code></pre> <p>but this code is not working for me. I tried this code for test and it is working:</p> <pre><code>$export = 'some html codes' $repthis = "text1"; $reptothis = "text2"; $export = str_replace($repthis, $reptothis, $export); </code></pre> <p>this code is replacing text1 by text2 in my html code correctly. please help me.</p>