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 - strlen

Trieda

Koreň \ Bez triedy

Metóda - strlen

(PHP 4, PHP 5, PHP 7)

The strlen() function is used to measure the length of a string.

Note:The function returns the number of bytes instead of the number of characters. (For pure ASCII texts without accept characters are the values the same). To determine the length of modern-encoded strongs, use the mb_strlen() function.

Procedurálne

  • function strlen (string $string) : int

Parametre

NázovDátový typPredvolená hodnotaPopis
$stringstring

The string which length we want to determine.

Mávratovej hodnoty

Vracia: int

Returns the length of the specified string. Returns null if an array is passed and in this case a warning is emited.

Príklady

<?php
echo strlen(' testx '); // Returns 7 (The length of specified string)
echo '<br>';
echo strlen(' testč ');  // Returns 8 (The number of bytes)

Súvisiace manuály

      • function count (mixed $array_or_countable, int $mode = COUNT_NORMAL) : int
      • function mb_strlen (string $str, string $encoding = mb_internal_encoding()) : mixed
      Aktivity