3v4l.org

run code in 500+ PHP versions simultaneously
<?php $differences = []; for ($_1 = 0; $_1 <= 0xff; $_1++) { $first_byte = chr($_1); for ($_2 = 0; $_2 <= 0xff; $_2++) { $second_byte = chr($_2); $two_bytes_sequence = $first_byte . $second_byte; assert( mb_convert_encoding($two_bytes_sequence, 'UTF-8', 'CP932') === mb_convert_encoding($two_bytes_sequence, 'UTF-8', 'SJIS-win') ); $cp932 = mb_convert_encoding($two_bytes_sequence, 'CP932', 'UCS-2'); $sjis_win = mb_convert_encoding($two_bytes_sequence, 'SJIS-win', 'UCS-2'); if ($cp932 !== $sjis_win) { $differences[] = [ sprintf('%02x', $_1), sprintf('%02x', $_2), mb_convert_encoding($two_bytes_sequence, 'UTF-8', 'UCS-2'), $cp932, array_map(fn ($byte) => sprintf('%02x', ord($byte)), str_split($cp932)), $sjis_win, array_map(fn ($byte) => sprintf('%02x', ord($byte)), str_split($sjis_win)), ]; } } } var_dump($differences);
Output for 8.1.0 - 8.1.10
array(0) { }
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.11 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
array(2) { [0]=> array(7) { [0]=> string(2) "00" [1]=> string(2) "a5" [2]=> string(2) "¥" [3]=> string(1) "\" [4]=> array(1) { [0]=> string(2) "5c" } [5]=> string(2) "��" [6]=> array(2) { [0]=> string(2) "81" [1]=> string(2) "8f" } } [1]=> array(7) { [0]=> string(2) "20" [1]=> string(2) "3e" [2]=> string(3) "‾" [3]=> string(1) "~" [4]=> array(1) { [0]=> string(2) "7e" } [5]=> string(2) "�P" [6]=> array(2) { [0]=> string(2) "81" [1]=> string(2) "50" } } }

preferences:
32.92 ms | 1146 KiB | 11 Q