note 35564 deleted from function.preg-replace by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:33:14 +0000 |
| Subject: | note 35564 deleted from function.preg-replace by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57482@lists.php.net to get a copy of this message | ||
Note Submitter:
----
there is another posted example that should NOT be used as it is incorrect:
Original function:
<?PHP
function stripPhp($phpstring) {
return preg_replace("'<\?php.*?\?>'", "\n<!-- PHP CODE REMOVED
-->\n",$phpstring);
}
?>
Should be:
<?PHP
function stripPhp($phpstring) {
return preg_replace("/<\?php.*?\?>/is", "\n<!-- PHP CODE REMOVED
-->\n",$phpstring);
}
?>
as the first one does a case sensative search and does not use the /s switch the following would not
be matched:
"<?PHP bla bla ?>"
"<?php
bla
bla
?>"