Last active
December 3, 2020 16:17
-
-
Save krmgns/8009975 to your computer and use it in GitHub Desktop.
PHP "ctype_print" for unicode (UTF-8)...
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 | |
define("CTYPE_PRINT_UNICODE_PATTERN", "~^[\pL\pN\s\"\~". preg_quote("!#$%&'()*+,-./:;<=>?@[\]^_`{|}´") ."]+$~u"); | |
function ctype_print_unicode($input) { | |
return preg_match(CTYPE_PRINT_UNICODE_PATTERN, $input); | |
} | |
print ctype_print_unicode("3 muços?"); // 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doesn't seem to work with
and characters like
≠
etc.