Hello, how to cut a certain group of words in a string, for example, "<img src='images/smiles/grin.gif</a>" from a reply. I am new to PHP, please help. Thanks very much in advance.
Wow! You are on line? Thank you for this promt reply, but the other problem is that the everytime last words are all different, because they are dynamic, like: <img src='images/smiles/grin.gif</a> <img src='images/smiles/shy.gif</a> <img src='images/smiles/rose.gif</a> <img src='images/smiles/laugh.gif</a> <img src='images/smiles/smoking.gif</a> but really really thank you for the help so far!
Hi mallorcahp, I just realized that the replacing string is much longer than I found , they are something like: "<img src='images/smiles/grin.gif' smilietext=':grin:' border='0' style='vertical-align:middle' alt=':grin:' title=':grin:' />" so it is very likely for me to make mistakes with a "/" or "\" more or less.... so logically, is it a better way to search for all what is inside the <img ... /> tag (including numbers) and replace them? I will write: $pattern="/<img [a-zA-Z][0-9]>\/>/", is it correct? Thank you for your help.
This will kill all images in the message i think you want it <?php $message = "Your message"; $messagewithoutquotes=cleanQuotes($message); function cleanQuotes($message){ $begin=strstr($message,'<img'); $rest=strstr($begin,'/>'); $interested=str_replace($rest,"",$begin); if(eregi("<img",$interested): cleanQuotes($interested); endif; return $interested } ?> PHP: