3v4l.org

run code in 300+ PHP versions simultaneously
// Source - https://stackoverflow.com/q/79908777 // Posted by Sarah // Retrieved 2026-03-16, License - CC BY-SA 4.0 <?php $myString = "\x65\x92"; $isValidEncoding = mb_check_encoding($myString, 'UTF-8'); if(!$isValidEncoding){ //This code does successfully execute //since the string is not utf-8 encoding. echo "Invalid Encoding!"; } ?>
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
// Source - https://stackoverflow.com/q/79908777 // Posted by Sarah // Retrieved 2026-03-16, License - CC BY-SA 4.0 Invalid Encoding!

preferences:
59.11 ms | 706 KiB | 4 Q