NOVINKA: Najžiadanejšie rekvalifikačné kurzy teraz s 50% zľavou + kurz AI ZADARMO. Nečakaj, táto ponuka dlho nevydrží! Zisti viac:

PHP - mb_strlen

Trieda

Koreň \ Bez triedy

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ázovDátový typPredvolená hodnotaPopis
$strstring

The string to get the length of.

$encodingstring 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

      Aktivity