3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on 2LeZu
Output for 5.0.2 - 7.2.6
3 Array ( [0] => Array ( [0] => 44 [1] => 555 [2] => AA ) [1] => Array ( [0] => 4 [1] => 5 [2] => A ) )
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/idg1i on line 6 3PHP_EOLArray ( [0] => Array ( [0] => 44 [1] => 555 [2] => AA ) [1] => Array ( [0] => 4 [1] => 5 [2] => A ) )
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/idg1i on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/idg1i on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/idg1i on line 4