- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- implode: documentation ( source)
- sort: documentation ( source)
- str_split: documentation ( source)
<?php
$pwd = "abc123AABC44555";
$pattern = '/(.)\1+/';
$x = str_split($pwd); sort($x);
$pwdSorted = implode("", $x);
echo (int)preg_match_all($pattern, $pwdSorted, $repChars).PHP_EOL;
print_r($repChars);