Home >Backend Development >PHP Tutorial > 求教PHP正则匹配有关问题

求教PHP正则匹配有关问题

WBOY
WBOYOriginal
2016-06-13 12:38:20974browse

求教PHP正则匹配问题
各位大虾,我是一个编程爱好者,初学PHP,遇到一个正则表达式匹配问题,百思不得解,特来求教。
我的代码如下:
nbsp;HTML>



第一个PHP网页


<br>
<?php <br />
$str = "akk c";<br>
$pattern="/(.)\1/";<br>
echo preg_match($pattern,$str,$matches)."<br>";<br>
var_dump($matches);<br>
?><br>




按说要能匹配“kk”,但输出结果却是:
0
array (size=0)
  empty

谢谢!

另:我的环境配置是:
服务器版本: 5.6.12-log - MySQL Community Server (GPL)
Apache/2.4.4 (Win64) PHP/5.4.12
php 正则表达式
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