Created
July 28, 2017 10:38
-
-
Save andreyserdjuk/ab1361577b32049ef422ea71181331a1 to your computer and use it in GitHub Desktop.
is unicode string?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$message = 'test'; | |
if ('ASCII' !== mb_detect_encoding($message, 'ASCII', true)) { | |
echo 'Unicode' . PHP_EOL; | |
} else { | |
echo 'ASCII' . PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment