3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jis_bytes = '1b244224221b2842'; // 'あ' in ISO-2022-JP $jis_bytes_without_esc = '1b24422422'; // 'あ' in ISO-2022-JP without escape sequence var_dump(mb_check_encoding(hex2bin($jis_bytes), 'JIS')); var_dump(mb_check_encoding(hex2bin($jis_bytes_without_esc), 'JIS'));
Output for 8.0.1 - 8.0.30, 8.1.18 - 8.1.34, 8.2.5 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
bool(true) bool(false)
Output for 8.1.0 - 8.1.17, 8.2.0 - 8.2.4
bool(true) bool(true)

preferences:
87.44 ms | 1103 KiB | 4 Q