How to check if a variable contains 5 consecutive numbers how to check if a variable contains 5 consecutive numbers, for example, $ str & quot; ads sends a lsd to lose weight at home and falls in love with the other party, and serves as a waste of money. The second doctor is under the law of 48955235, and the second teacher will immediately learn about this. & quot ;; how can I check whether the str variable contains 5 consecutive numbers (consisting of 0-9 digits? ------ solution ------------------ how can I check whether a variable contains 5 consecutive numbers in regular expression matching?
How to check whether a variable contains five consecutive numbers?
For example:
$ Str = "ads sends a lsd to lose weight when it is put at home, and falls in love with the other party, and serves as a waste of money. doctor Sada is under the law of 48955235, and the local teachers will immediately learn about it ";
How can I check whether the str variable contains 5 consecutive numbers (consisting of 0-9 digits,
------ Solution --------------------
Regular Expression Matching
PHP code
$ Str = "ads sends a lsd to lose weight when it is put at home, and falls in love with the other party, and serves as a waste of money. doctor Sada is under the law of 48955235, and the local teachers will immediately learn about it "; $ p = "/\ d {5}/I"; preg_match_all ($ p, $ str, $ result); var_dump ($ result );