51 of 410 menu

The strlen Function

The strlen function returns the length of a string (the number of characters in the string). It works correctly only with Latin characters (single-byte characters).

Syntax

strlen(string $string): int

Example

In this example, the function will return the length of the string 'abcde':

<?php echo strlen('abcde'); ?>

Code execution result:

5

See Also

  • the count function,
    which returns the length of an array
byenru