Hi guys, below are simple script for word replacement, it is replacing a word in to link PHP Code: $word = array( 'google', 'yahoo' ); $link = array( 'google', 'yahoo' ); $this->post['message'] = str_ireplace($word, $link, $this->post['message']); for example text i love google result the output printed will be like this HTML Code: i love google result it is just replacing google text into a link like this google but the problem is if the original google text is already inside a link, like this HTML Code: i love google result the output printed will be broken like this, there will be double hyperlink HTML Code: i love google result please help guys, how to exclude the text google inside hyperlinks above from replaced, but the text google outside hyperlinks are still replaced maybe using if statement in the simple script above, or other way
[How to] Exclude replacement inside hyperlinks, maybe using if statement,or other way
2
Hi guys, below are simple script for word replacement, it is replacing a word in to link please help guys, how to exclude the text google inside hyperlinks above from replaced, but the text google outside hyperlinks are still replaced maybe using if statement in the simple script above, or other way
PHP Code:
$word = array( 'google', 'yahoo' ); $link = array( 'google', 'yahoo' ); $this->post['message'] = str_ireplace($word, $link, $this->post['message']);
- Jerry Jackson
- Jerry Jackson
Next Topics on Trending Feed
-
2