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.28, 8.2.5 - 8.2.18, 8.3.0 - 8.3.6
bool(true) bool(false)
Output for 8.1.0 - 8.1.17, 8.2.0 - 8.2.4
bool(true) bool(true)

preferences:
103.54 ms | 402 KiB | 89 Q