blufish Posted July 21, 2008 Share Posted July 21, 2008 is it possible to strip php tags without stripping html tags? thanks in advance! Link to comment https://forums.phpfreaks.com/topic/115796-can-you-strip-php-tags-without-stripping-html/ 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 Link to comment https://forums.phpfreaks.com/topic/115796-can-you-strip-php-tags-without-stripping-html/#findComment-595271 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. Link to comment https://forums.phpfreaks.com/topic/115796-can-you-strip-php-tags-without-stripping-html/#findComment-595275 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? Link to comment https://forums.phpfreaks.com/topic/115796-can-you-strip-php-tags-without-stripping-html/#findComment-595276 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. Link to comment https://forums.phpfreaks.com/topic/115796-can-you-strip-php-tags-without-stripping-html/#findComment-595277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.