str_replace() is fine for this.
<?php
$what = array(
":)",
":D",
":P"
);
$with = array(
"<img src='smile.gif' alt='Smile' />",
"<img src='grin.gif' alt='Grin' />",
"<img src='tongue.gif' alt='Tongue' />"
);
$content = str_replace($what, $with, $content);
?>
Or you could set it up how you have, using array_keys() and array_values().