PHP - strlen
Trieda
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ázov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $string | string | 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)
