Correct

if (mb_strlen($name, 'UTF-8') < 3) is sufficient enough

make sure header is correct

HTTP-header (Content-Type: text/html; charset=UTF-8)

you can also check alternative for some reason

strlen(utf8_decode($string))

UTF-8 to Code Point Array Converter in PHP

Answer from Pramendra Gupta on Stack Overflow
🌐
PHP
php.net › manual › en › function.mb-strlen.php
PHP: mb_strlen - Manual
If you need length of string in ... '8bit'); ?>. It's the fastest way (still a way slower than strlen, though) to determine byte length of string....
🌐
GeeksforGeeks
geeksforgeeks.org › php › php-mb_strlen-function
PHP mb_strlen() Function - GeeksforGeeks
April 13, 2023 - The mb_strlen() is an inbuilt PHP function that returns the string length in an integer.
🌐
Code.mu
code.mu › en › php › manual › string › mb_strlen
The mb_strlen Function - Getting String Length in PHP
The mb_strlen function returns the number of characters in a string, working correctly with multibyte encodings (for example, UTF-8). Unlike strlen, it correctly counts characters that occupy multiple bytes. It takes the string as the first parameter and the encoding as the second (optional) one.
🌐
Illinois State Museum
museum.state.il.us › ismdepts › library › linuxguides › php › function.mb-strlen.html
mb_strlen
(PHP 4 CVS only)mb_strlen -- Get string length · string mb_strlen (string str [, string encoding]) mb_strlen() returns number of characters in string str having character encoding encoding. A multi-byte character is counted as 1.
🌐
Quora
quora.com › What-is-difference-between-mb_strlen-and-strlen-in-PHP
What is difference between mb_strlen() and strlen() in PHP? - Quora
Answer (1 of 10): Ascii characters are 1 byte in length. [code ]strlen[/code] function assumes that every character is 1 byte in length, which works fine for English language. But when you start dealing with non English languages, characters can take more than 1 byte to represent. The number of ...
🌐
OnlinePHP
onlinephp.io › mb-strlen
mb_strlen - Online Tool
PHP Functions · Multibyte String · mb_strlen · Execute mb_strlen with this online tool mb_strlen() - Get string length · Mb Strlen Online Tool · Manual · Code Examples · Mb Strlen Online Tool · Manual · Code Examples · mb_check_encoding · mb_chr · mb_convert_case ·
🌐
Php-safari
php-safari.com › function › mb_strlen
PHP function - mb_strlen | PHP Safari
mb_strlen($runTime); $width = min(terminal()->width(), 150); $dots = max($width - $descriptionWidth - $runTimeWidth - 10, 0);
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › php-get-the-string-length-using-mb-strlen
PHP – Get the string length using mb_strlen()
August 23, 2021 - In PHP, multibyte string length (mb_strlen) function is used to get the total string length of a specified string. This function is supported in PHP 4.6.0 or higher versions. Syntax
🌐
OnlinePHP
onlinephp.io › mb-strlen › manual
mb_strlen - OnlinePHP.io Example
Execute mb_strlen Online. Info and examples on mb_strlen PHP Function from Multibyte String - Human Language and Character Encoding Support
🌐
Reintech
reintech.io › term › using-mb-strlen-for-multibyte-strings-php
Using the mb_strlen() Function for Multibyte Strings in PHP | Reintech media
This function measures the length of a string with multibyte characters. Unlike strlen(), it accounts for character encodings like UTF-8 where characters can be represented by multiple bytes.
🌐
Abanoub Hanna
abanoubhanna.com › posts › mb_strlen-or-strlen-php
Should I use `mb_strlen($text, 'utf-8')` or `strlen($text)` in PHP ? | Abanoub Hanna
April 15, 2024 - 🔗 Accuracy for Multibyte Characters: mb_strlen is designed for handling multibyte character encodings like UTF-8. It considers characters that can be composed of multiple bytes, giving you the correct character count. strlen assumes single-byte characters and might undercount the length ...
🌐
PHP Tutorial
phptutorial.net › home › php tutorial › php strlen
PHP strlen(): Get the Length of a String in Bytes Examples
April 7, 2025 - Use the PHP strlen() function to get the number of bytes of a string. Use the PHP mb_strlen() function to get the number of characters in a string with a specific encoding.
🌐
Cakephp
api.cakephp.org › 2.10 › function-mb_strlen.html
Function mb_strlen | CakePHP 2.10
Package: Cake Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) License: MIT License Located at Cake/bootstrap.php · mb_strlen( string $string , string $encoding = null )
🌐
Nusphere
nusphere.com › kb › phpmanual › function.mb-strlen.htm
PHP Manual: mb_strlen
PhpED - PHP IDE integrated development environment for developing web sites using PHP, HTML, Perl, JScript and CSS that combines a comfortable editor, debugger, profiler with the MySQl, PostrgeSQL database support based on easy wizards and tutorials.Easy to use for debugging PHP scripts, publishing ...
🌐
GitHub
github.com › php › php-src › blob › master › ext › mbstring › tests › mb_strlen.phpt
php-src/ext/mbstring/tests/mb_strlen.phpt at master · php/php-src
July 2, 2018 - mb_strlen() --EXTENSIONS-- mbstring · --FILE-- <?php · // TODO: Add more encodings · · ini_set('include_path', __DIR__); include_once('common.inc'); · // restore detect_order to 'auto' mb_detect_order('auto'); · // Test string ·
Author   php