Str_replace

I’m using a javascript and this code to try and replace smiley code with the smilies in a guestbook. It DOES work except it displays both the smiley AND the code. Help?

[php]<?php
$code = array(":angry:",":biggrin:",":blah:");
$img = array("<img src=“smilies/angry.gif”/>","<img src=“smilies/biggrin.gif”/>","<img src=“smilies/blah.gif”/>");
echo str_replace($code,$img,$entry[“comments”]);
?>[/php]

You php code seem to be fine. The problem is definitely not in this piece of code what you posted, somewhere else in your script.

Sponsor our Newsletter | Privacy Policy | Terms of Service