$word = array( 'My Link' ); $link = array( '<a href="link.php">My Link</a>'); $this->post['message'] = str_ireplace($word, $link, $this->post['message']);