Topic: How would you go about on doing this? (str_replace related)
I want to have multiple emoticons to represent an image, such as and :'( all linked to sad.png. This is what I've tried:
<?php
$array1 = array(':)', ':D', array(':(', ':/'));
$array2 = array('happy', 'exicited', 'sad');
echo str_replace($array1, $array2, ':) :D :( :/');
//happy exicited :( :/
?>
It doesn't output what I want (happy excited sad sad). Is this because str_replace doesn't handle multi-dimensional arrays? If so, what is the most efficient way of doing this? Just replicating the value? (i.e $array2 = array('happy', 'exicited', 'sad', 'sad');)