Must be missing something here but str_replace isnt working for me, take this simple example,

PHP Code:
<?php

$a 
"http://somesite.com/index.cfm?&user=24706091";
$b str_replace("&","&amp;",$a);
echo 
$b;

?>
Result is still the original url whereas it should be,

http://somesite.com/index.cfm?&amp;user=24706091