How does PHP determine whether a string contains repeated numbers?

Source: Internet
Author: User
How does PHP determine that a string contains repeated numbers? For example, I have such a string: a01a02a03a04 ....... a11a220a303 where a11, a220, and a303 both have two duplicates: 1, 2, and 3. how can I use a statement to determine the cause. If two numbers in the string are the same, they are true. Otherwise, it is false. ------ Solution -------------------- var_dump (how does preg_ma PHP determine whether a string contains repeated numbers?
For example, I have such a string:
A01
A02
A03
A04
.......
A11
A220
A303

Among them: a11, a220, and a303 all have two duplicate 1, two 2, and two 3.
How can I use a statement to determine the cause. If two numbers in the string are the same, they are true. Otherwise, it is false.
------ Solution --------------------
Var_dump (preg_match ('/(\ d). * \ 1/', 'a303')> 0); // bool (true)
Var_dump (preg_match ('/(\ d). * \ 1/', 'a203 ')> 0); // bool (false)
Var_dump (preg_match ('/(\ d). * \ 1/', 'a220')> 0); // bool (true)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.