Skip to content

Instantly share code, notes, and snippets.

@andreyserdjuk
Created July 28, 2017 10:38
Show Gist options
  • Save andreyserdjuk/ab1361577b32049ef422ea71181331a1 to your computer and use it in GitHub Desktop.
Save andreyserdjuk/ab1361577b32049ef422ea71181331a1 to your computer and use it in GitHub Desktop.
is unicode string?
<?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