3v4l.org

run code in 500+ 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.2.5 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0, 8.1.18 - 8.1.34, 8.0.1 - 8.0.30
bool(true) bool(false)
Output for 8.2.0 - 8.2.4, 8.1.0 - 8.1.17
bool(true) bool(true)

preferences:
22.73 ms | 1175 KiB | 6 Q