⊗ppPmBsCyP 31 of 447 menu

The Problem with Cyrillic in PHP

The function strlen, like many other string functions in PHP, does not work correctly with Cyrillic - it counts each Cyrillic letter twice:

<?php echo strlen('абвгд'); // will output 10, not 5 ?>

Therefore, for strings that contain or potentially may contain problematic characters, use the function mb_strlen - it will work correctly:

<?php echo mb_strlen('абвгд'); // will output 5 ?>

Write some Cyrillic string into a variable. Display the length of your string on the screen.

byenru