(PHP 4, PHP 5, PHP 7)
strlen — 锟斤拷取锟街凤拷锟斤拷锟斤拷锟斤拷
$string
) : int
锟斤拷锟截革拷锟斤拷锟斤拷锟街凤拷锟斤拷 string
锟侥筹拷锟饺★拷
string
锟斤拷要锟斤拷锟姐长锟饺碉拷锟街凤拷锟斤拷锟斤拷
锟缴癸拷锟津返伙拷锟街凤拷锟斤拷 string
锟侥筹拷锟饺o拷锟斤拷锟� string
为锟秸o拷锟津返伙拷 0锟斤拷
锟芥本 | 说锟斤拷 |
---|---|
5.3.0 |
Prior versions treated arrays as the string Array, thus returning
a string length of 5 and emitting an E_NOTICE 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 anE_WARNING
level error is emitted.