blufish Posted July 21, 2008 Share Posted July 21, 2008 is it possible to strip php tags without stripping html tags? thanks in advance! Quote Link to comment Share on other sites More sharing options...
papaface Posted July 21, 2008 Share Posted July 21, 2008 http://uk3.php.net/manual/en/function.strip-tags.php Quote Link to comment Share on other sites More sharing options...
unkwntech Posted July 21, 2008 Share Posted July 21, 2008 '/(?:<\?|<\?php)(?:.*|\t*|\r*|\n*|\r\n*|\a*|\e*|\f*|\v*)*\?>/' This is a regex that will catch anything between <? and ?> or <?php and ?> $pattern = '/(?:<\?|<\?php)(?:.*|\t*|\r*|\n*|\r\n*|\a*|\e*|\f*|\v*)*\?>/'; $text = preg_replace($pattern, '', $sourceText); Assumming $sourceText = the text file read in. This is remove any an all PHP from the file and will store it in the $text variable. Quote Link to comment Share on other sites More sharing options...
samshel Posted July 21, 2008 Share Posted July 21, 2008 strip php tags ?? you mean you have php tags in your HTML page, displayed to the user? Quote Link to comment Share on other sites More sharing options...
unkwntech Posted July 21, 2008 Share Posted July 21, 2008 I assumed that he was removing the php from something submitted by a user. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.