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)