3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo mb_detect_encoding('garcía'); print "\n"; echo mb_detect_encoding('García'); print "\n"; echo is_utf8('garcía'); print "\n"; echo is_utf8('García'); print "\n"; echo is_utf82('garcía'); print "\n"; echo is_utf82('García'); print "\n"; echo is_utf83('garcía'); print "\n"; echo is_utf83('García'); function is_utf8($str) { return (bool) preg_match('//u', $str); } function is_utf82($str) { return (bool) preg_match('!!u', $str); } function is_utf83($str) { return ! (false === mb_detect_encoding($str, 'UTF-8', true)); } $text = "m%y@email.coms"; echo 'Original : ', $text, PHP_EOL; echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL; echo 'IGNORE : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL; echo 'Plain : ', iconv("UTF-8", "ISO-8859-1", $text), PHP_EOL;
based on 7Oo99
Output for 5.4.0 - 5.5.34, 5.6.0 - 5.6.20, 5.6.28 - 7.0.5, 7.0.20 - 7.2.0
UTF-8 UTF-8 1 1 1 1 1 1Original : m%y@email.coms TRANSLIT : m%y@email.coms IGNORE : m%y@email.coms Plain : m%y@email.coms
Output for 7.0.6 - 7.0.10
UTF-8 UTF-8 1 1 1 1 1 1Original : m%y@email.coms TRANSLIT : Fatal error: Uncaught Error: Call to undefined function iconv() in /in/rihQi:37 Stack trace: #0 {main} thrown in /in/rihQi on line 37
Process exited with code 255.
Output for 5.5.35 - 5.5.38, 5.6.21 - 5.6.25
UTF-8 UTF-8 1 1 1 1 1 1Original : m%y@email.coms TRANSLIT : Fatal error: Call to undefined function iconv() in /in/rihQi on line 37
Process exited with code 255.