I've got a problem where using two arrays with str_replace() just outputs the word 'Array' instead of the actual data inside the array. Here's the code: Code: <?php $input = ":) :O :D"; $smiley_folder = "smileys/"; $codes = array(':)', ':(', ':D', ':|', ':o', ':O', ':p', ':P', ';)'); $images = array('smile.gif', 'sad.gif', 'biggrin.gif', 'surprise.gif', 'omg.gif', 'omg.gif', 'tongue.gif', 'tongue.gif', 'wink.gif'); $output = str_replace($codes, "<img src=\"".$smiley_folder."".$images."\">", $input); echo $output; ?> The output is: Code: <img src="smileys/Array"> <img src="smileys/Array"> <img src="smileys/Array"> The original idea was to use MySQL to store the smiley data, but I had the exact same problem, so decided to do it this way, which doesn't work either! Here's the culprit page: http://www.sam0r.co.uk/includes/smiley.php It might be something really simple, but I haven't coded PHP in a couple of years (Moved to ASP because of my job )
$images is an array and you're trying to concatenate that array into a string as the replacement argument - that's why it won't work (and hence why you're seeing "Array"). You either need to change the replacements to include the HTML or change the structure of the code you have.