I have a long long $partner list, write in a single common file.
remove.inc
$partner =<<<EOT
"#<h1 class=\"logo\"(.*?)</h1>#s","#<h2 class=\"hidden\"(.*?)</h2>#s"
EOT;
//more $partner rules...
index.php
include(remove.inc);
$str = preg_replace(array($partner), '', $str);
this return:
Warning: preg_replace(): Unknown modifier ‘,’ in d:\www\indoor\index.php on line 12
$partneris supposed to be an array of strings, but it’s not: you are defining it as a string using HEREDOC syntax.The first character of the string is the double quote, which the regex engine treats as the delimiter. Therefore when the next unescaped double quote is encountered:
the engine assumes that whatever follows must be regex modifiers. Since
,is not a valid modifier the result is an error.The correct way to do it is
and used as