I'm trying to replace whole words in a string using str_replace, however, even letters matched in words are being replaced. i tried preg_replace, but couldn't get it to work as i have a big list of words to replace. Any help is appreciated.
$array2 = array('is','of','to','page');
$text = "homepage-of-iso-image";
echo $text1 = str_replace($array2,"",$text);
the output is : home--o-image