3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $encodings = mb_list_encodings(); var_dump(count($encodings)); $results = []; foreach ($encodings as $encoding) { foreach (["\r", "\r\n"] as $string) { if (strlen($string) !== mb_strlen($string, $encoding)) { $results[] = [ 'encoding' => $encoding, 'char' => "\r" === $string ? '\r' : '\r\n', 'strlen' => strlen($string), 'mb_strlen' => mb_strlen($string, $encoding), ]; } } } print_r($results);
based on UMIlJ
Output for 7.3.0 - 7.3.1
int(86) Array ( [0] => Array ( [encoding] => pass [char] => \r [strlen] => 1 [mb_strlen] => ) [1] => Array ( [encoding] => pass [char] => \r\n [strlen] => 2 [mb_strlen] => ) [2] => Array ( [encoding] => wchar [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [3] => Array ( [encoding] => wchar [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [4] => Array ( [encoding] => BASE64 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [5] => Array ( [encoding] => BASE64 [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [6] => Array ( [encoding] => UCS-4 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [7] => Array ( [encoding] => UCS-4 [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [8] => Array ( [encoding] => UCS-4BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [9] => Array ( [encoding] => UCS-4BE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [10] => Array ( [encoding] => UCS-4LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [11] => Array ( [encoding] => UCS-4LE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [12] => Array ( [encoding] => UCS-2 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [13] => Array ( [encoding] => UCS-2 [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [14] => Array ( [encoding] => UCS-2BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [15] => Array ( [encoding] => UCS-2BE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [16] => Array ( [encoding] => UCS-2LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [17] => Array ( [encoding] => UCS-2LE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [18] => Array ( [encoding] => UTF-32 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [19] => Array ( [encoding] => UTF-32 [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [20] => Array ( [encoding] => UTF-32BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [21] => Array ( [encoding] => UTF-32BE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [22] => Array ( [encoding] => UTF-32LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [23] => Array ( [encoding] => UTF-32LE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [24] => Array ( [encoding] => UTF-16 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [25] => Array ( [encoding] => UTF-16 [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [26] => Array ( [encoding] => UTF-16BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [27] => Array ( [encoding] => UTF-16BE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [28] => Array ( [encoding] => UTF-16LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [29] => Array ( [encoding] => UTF-16LE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) )
Output for 5.6.0 - 5.6.38, hhvm-3.15.4, 7.0.0 - 7.2.13
int(87) Array ( [0] => Array ( [encoding] => wchar [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [1] => Array ( [encoding] => wchar [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [2] => Array ( [encoding] => BASE64 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [3] => Array ( [encoding] => BASE64 [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [4] => Array ( [encoding] => UCS-4 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [5] => Array ( [encoding] => UCS-4 [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [6] => Array ( [encoding] => UCS-4BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [7] => Array ( [encoding] => UCS-4BE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [8] => Array ( [encoding] => UCS-4LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [9] => Array ( [encoding] => UCS-4LE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [10] => Array ( [encoding] => UCS-2 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [11] => Array ( [encoding] => UCS-2 [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [12] => Array ( [encoding] => UCS-2BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [13] => Array ( [encoding] => UCS-2BE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [14] => Array ( [encoding] => UCS-2LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [15] => Array ( [encoding] => UCS-2LE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [16] => Array ( [encoding] => UTF-32 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [17] => Array ( [encoding] => UTF-32 [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [18] => Array ( [encoding] => UTF-32BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [19] => Array ( [encoding] => UTF-32BE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [20] => Array ( [encoding] => UTF-32LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [21] => Array ( [encoding] => UTF-32LE [char] => \r\n [strlen] => 2 [mb_strlen] => 0 ) [22] => Array ( [encoding] => UTF-16 [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [23] => Array ( [encoding] => UTF-16 [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [24] => Array ( [encoding] => UTF-16BE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [25] => Array ( [encoding] => UTF-16BE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) [26] => Array ( [encoding] => UTF-16LE [char] => \r [strlen] => 1 [mb_strlen] => 0 ) [27] => Array ( [encoding] => UTF-16LE [char] => \r\n [strlen] => 2 [mb_strlen] => 1 ) )