strlen
(PHP 4, PHP 5)
strlen — 获取字符串长度
说明
int strlen
( string $string
)
   返回给定的字符串 string 的长度。
  
参数
string
      
需要计算长度的字符串。
返回值
   成功则返回字符串 string 的长度;如果 string 为空,则返回 0。
  
更新日志
  版本
  说明
  5.3.0
   Prior versions treated arrays as the string Array, thus returning
   a string length of 5 and emitting an <strong><code>E_NOTICE</code></strong> level error.范例
Example #1 strlen() 范例
<?php
$str = 'abcdef';
echo strlen($str); // 6
$str = ' ab cd ';
echo strlen($str); // 7
?>
注释
Note:
strlen() returns the number of bytes rather than the number of characters in a string.
Note:
    strlen() returns NULL when executed on arrays, and
    an E_WARNING level error is emitted.
   
参见
count() - 计算数组中的单元数目或对象中的属性个数 mb_strlen() - 获取字符串的长度