1--TEST-- 2Test mb_strlen() function : basic functionality 3--SKIPIF-- 4<?php 5extension_loaded('mbstring') or die('skip'); 6function_exists('mb_strlen') or die("skip mb_strlen() is not available in this build"); 7?> 8--FILE-- 9<?php 10/* Prototype : int mb_strlen(string $str [, string $encoding]) 11 * Description: Get character numbers of a string 12 * Source code: ext/mbstring/mbstring.c 13 */ 14 15/* 16 * Test basic functionality of mb_strlen() 17 */ 18 19echo "*** Testing mb_strlen() : basic functionality***\n"; 20 21$string_ascii = b'abc def'; 22//Japanese string in UTF-8 23$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII='); 24 25echo "\n-- ASCII String --\n"; 26var_dump(mb_strlen($string_ascii)); 27 28echo "\n-- Multibyte String --\n"; 29var_dump(mb_strlen($string_mb, 'UTF-8')); 30 31echo "\nDone"; 32?> 33 34--EXPECTF-- 35*** Testing mb_strlen() : basic functionality*** 36 37-- ASCII String -- 38int(7) 39 40-- Multibyte String -- 41int(21) 42 43Done 44