PHP Error - str_replace

Hi Guys,

I need some help. Here is some of my code:

$string = $pixelurl;
$string = addslashes(str_replace(array('$subid', '$adid', '$subid2'), array($subid, $adid, $subid2), $string));

?>

<iframe name="thirdparty" src="<? echo $string; ?>" frameborder="0" height="1" width="1" /></iframe>

When the iframe loads instead of replacing $subid2 with $subid2 it keeps replacing it with the value of $subid. The only reason i can see why this is happening is because it sees $subid first and ignores the 2 at the end. Can anyone help me fix this problem please?

Thanks

Move subid2 before subid in the array. str_replaces() processes the match/replacement pairs from left to right so what you’ll see is “$subid2” being replaced with “<value from $subid>2”, this replaced value does not match the text “$subid2” so will not be replaced by the latter’s value.