如何查一个变量中含有连续的5个数字

WBOY
Release: 2016-06-13 10:21:45
Original
914 people have browsed it

怎么查一个变量中含有连续的5个数字
怎么查一个变量中含有连续的5个数字
如:

$str = "ads放家里就发个lsd减肥爱上了对方萨达浪费士大夫受到法律48955235萨达浪费撒地方老师地方就立即了解";
怎么查出str变量中是否有连续的5个数字(0-9 任何数字组成的,

------解决方案--------------------
正则匹配

PHP code
$str = "ads放家里就发个lsd减肥爱上了对方萨达浪费士大夫受到法律48955235萨达浪费撒地方老师地方就立即了解";$p = "/\d{5}/i";preg_match_all($p, $str, $result);var_dump($result);<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template