> Hello, i have array $reserved_words which i want to replace with bold > .. but when i tried to do str_replace($reserved_words, > "<b>".$reserved_words."</b>", $string) it showed Array instead of > <b>word</b> > if i simply do str_replace($reserved_words, $reserved_words, > $string) then it shows the words not Array but not in bold ;) > I know i could use 2 arrays one with bold words one without or i > could use foreach but i want a simpler solution :)... Any suggestions
That does make sence. You try to append <b> and prepend </b> to an array, which will (of course) be converted to string then. Result is that you're call to the str_replaced function can also be written as: str_replace( $reserved_words, '<b>Array</b>', $string ) which is definitely not what you want! You have two options: a) Create another array of reserved_words, only then appended and prepended with <b> and </b> b) Use the code from Olinux Option B sounds best to me ;-)) HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php