Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP中EREGI的替代函数_Php_Regex_Preg Match_Eregi - Fatal编程技术网

PHP中EREGI的替代函数

PHP中EREGI的替代函数,php,regex,preg-match,eregi,Php,Regex,Preg Match,Eregi,我再次制作了一个联系人表单,并在上面使用了eregi()。但是我们都知道,在PHP5.3上,eregi()函数已经被弃用,所以我想知道我可以使用什么替代函数来替换函数eregi()?我试过了!preg_match,即使我得到了所需的输出,似乎仍然存在错误!>3必须用分隔符包围正则表达式: preg_match("/to:/",$field) here __^ ^ 从您的“正则表达式”中,您是否只需要stripos?TBH,我不知道正则表达式是什么,我太懒了,因为我很忙,所以无法学

我再次制作了一个联系人表单,并在上面使用了eregi()。但是我们都知道,在PHP5.3上,eregi()函数已经被弃用,所以我想知道我可以使用什么替代函数来替换函数eregi()?我试过了!preg_match,即使我得到了所需的输出,似乎仍然存在错误!>3必须用分隔符包围正则表达式:

preg_match("/to:/",$field)
     here __^   ^

从您的“正则表达式”中,您是否只需要
stripos
?TBH,我不知道正则表达式是什么,我太懒了,因为我很忙,所以无法学习。顺便说一句,什么是“脱衣舞”?我在网上搜索过,大多数答案都是我应该用的!预赛。但是当我使用它时出现了一个错误。您似乎只想知道例如“to:”是否存在于
$field
中。如果这是真的,那么它根本不需要RegExp。尝试
if(stripos($field,“to:”)!==false | | stripos($field,“cc:”)!==false)
^这很有效!非常感谢!:)@不客气。请随意接受答案。
preg_match("/to:/",$field)
     here __^   ^