note 113919 deleted from function.mb-check-encoding by salathe
| From: | salathe@php.net | Date: | Sat, 14 Aug 2021 09:08:28 +0000 |
| Subject: | note 113919 deleted from function.mb-check-encoding by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216793@lists.php.net to get a copy of this message | ||
Note Submitter: eyecatchup at gmail dot com
----
Unlike other comments suggest, there's no need to serialize a string to use preg_match's
"u" modifier for testing if a string is valid UTF-8. You can just use
<?php
function is_utf8($str) {
return (bool) preg_match('//u', $str);
}