PHP - mb_strlen
Trieda
Metóda - mb_strlen
(PHP 4 >= 4.0.6, PHP 5, PHP 7)
The mb_strlen() function (as multi-byte string length) gets the
length of a string (i.e. the number of characters). It replaces the old
strlen() function that returned the number of characters of the
string in ASCII encoding and it did not support special characters in UTF-8
encoding.
Procedurálne
- function mb_strlen (string $str, string $encoding = mb_internal_encoding()) : mixed
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $str | string | The string to get the length of. | |
| $encoding | string | mb_internal_encoding() | The encoding parameter. |
Mávratovej hodnoty
Vracia: mixed
The length of a string.
Príklady
<?php
echo "strlen(): " . strlen("♥ is heart");
echo "<br />";
echo "mb_strlen(): " . mb_strlen("♥ is heart");
Súvisiace manuály
- function mb_internal_encoding (string $encoding = mb_internal_encoding()) : mixed
- function strlen (string $string) : int
