array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'function.strlen.php', 1 => 'strlen', ), 'up' => array ( 0 => 'ref.strings.php', 1 => 'Funções de String', ), 'prev' => array ( 0 => 'function.stristr.php', 1 => 'stristr', ), 'next' => array ( 0 => 'function.strnatcasecmp.php', 1 => 'strnatcasecmp', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'pt_BR', 'path' => 'reference/strings/functions/strlen.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
strlen — Retorna o tamanho de uma string
O tamanho da string
em bytes.
Exemplo #1 Exemplo de strlen()
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
Nota:
strlen() retorna o número de bytes em vez do número de caracteres de uma string.