How to Ignore certain tags and replace texts in PHP

Posted by Aakash Chakravarthy on Stack Overflow See other posts from Stack Overflow or by Aakash Chakravarthy
Published on 2010-06-11T06:08:05Z Indexed on 2010/06/11 6:12 UTC
Read the original article Hit count: 310

Filed under:
|

Hello,

I have a variable like

$content = "Lorem Ipsum is simply <b>dummy text of the printing</b> and typesetting industry.
 Lorem Ipsum has been the industry's <i>standard dummy text</i> ever since the 1500s 
<string>javascriptFunc();</script>" ;

when i use str_replace('a', '', $content); all the 'a's get removed. But the 'a's within the <script> tag should not be removed.

or is there any way to replace text other than this method

Please help .

© Stack Overflow or respective owner

Related posts about php

Related posts about str-replace