PHP.nl

strlen

strlen

Get string length

int **strlen** string $string

Returns the length of the given . string

string The being measured for length. string

The length of the in bytes. string

Voorbeeld: A example

<?php
$str = 'abcdef';
echo strlen($str), PHP_EOL; // 6

$str = ' ab cd ';
echo strlen($str), PHP_EOL; // 7
?>

Opmerking: > returns the number of bytes rather than the number of characters in a string. strlen

count``grapheme_strlen``iconv_strlen``mb_strlen