Home >Backend Development >PHP Tutorial > php简单正则有关问题

php简单正则有关问题

WBOY
WBOYOriginal
2016-06-13 12:31:47773browse

php简单正则问题

<br />
<?php<br />
$timestamp = '2012年02月03 15:06:46';<br />
preg_match_all("/(.*?)年(.*?)/is", $timestamp, $rarr, PREG_SET_ORDER);<br />
print_r($rarr);<br />
<br />
preg_match_all("/(.*?)年(.*?)月(.*?) (.*?):(.*?):(.*?)/is", $timestamp, $rarr, PREG_SET_ORDER);<br />
print_r($rarr);<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