preg_match 中的 `e` 修饰符是什么意思?

What does `e` modifer mean in preg_match?

我正在审查 PHP 代码以查找可疑代码。我找到了

preg_match('/^' . preg_quote($var1, '/') . '/ie', $var2)

但是 php 不会像 The /e modifier is deprecated, use preg_replace_callback instead inUnknown modifier 'e' in 那样发出任何警告。

测试:http://3v4l.org/6i8ln

e (PREG_REPLACE_EVAL)修饰符对preg_match有特殊意义还是被忽略了?

好吧,在 preg_match() 中,修饰符 e 不会做任何事情,而且也已弃用。您可以在手册中阅读更多相关信息:http://php.net/manual/en/reference.pcre.pattern.modifiers.php

还有两句引述:

Warning: This feature has been DEPRECATED as of PHP 5.5.0. Relying on this feature is highly discouraged.

Note: Only preg_replace() uses this modifier; it is ignored by other PCRE functions.