note 112755 deleted from function.mb-check-encoding by salathe
| From: | salathe@php.net | Date: | Sat, 14 Aug 2021 09:08:19 +0000 |
| Subject: | note 112755 deleted from function.mb-check-encoding by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216790@lists.php.net to get a copy of this message | ||
Note Submitter: CertaiN
----
The best way to validate UTF-8 sequence.
This works for not only scalar, but also array and object recursively.
<?php
function is_valid_utf8($text) {
return (bool)preg_match('//u', serialize($text));
}
?>