3v4l.org

run code in 300+ PHP versions simultaneously
<?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;

preferences:
51.49 ms | 402 KiB | 5 Q