How does php determine whether a string contains four consecutive characters: PHPcode & lt ;? Php $ strphp: how to judge whether a string contains four consecutive characters: me and me; $ strphp: how to judge whether a string contains four consecutive characters: me, sssssssss; if (preg_match (& quot ;(.) \ 1 {3 ,}& quot;, $ str) {echo has continuous php. how can I determine whether a string contains four consecutive characters?
PHP code
The above code can only judge English and Chinese characters are unavailable. Is there any other method?
------ Solution --------------------
UTF-8 Chinese characters
If (preg_match ("/([\ x {4E00}-\ x {9FFF}]) \ 1 {3,}/u", $ str )){
------ Solution --------------------
UTF-8
Preg_match ("/(.) \ 1 {3,}/u", $ str)
For gbk
Preg_match ("/([\ x80-\ xff]. |.) \ 1 {3,}/", $ str)
A string cannot have two types of encoding at the same time.