Home >Backend Development >PHP Tutorial >php 正则表达式,该如何处理

php 正则表达式,该如何处理

WBOY
WBOYOriginal
2016-06-13 12:13:091013browse

php 正则表达式
$a ='A求值';
mb_eregi('A求值',$a,$tmp2);
var_dump($tmp2);




以上代码 不能匹配出来,但是把两个 ‘值’ 字都去掉就可以匹配出来,这是什么原因呢
------解决思路----------------------
显然你的程序是 utf-8 编码的

mb_regex_encoding ("utf-8"); //加上这个<br />$a ='A求值';<br />mb_eregi('A求值',$a,$tmp2);<br />var_dump($tmp2);
array(1) {<br />  [0]=><br />  string(7) "A求值"<br />}<br /><br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn