php怎么统计字符串长度

lewis 2016-11-27 19次阅读

在PHP中,可以使用内置函数strlen()来统计字符串的长度。示例如下:

$string = "Hello, World!";
$length = strlen($string);
echo "Length of the string: " . $length;

这段代码将输出:Length of the string: 13,表示字符串"Hello, World!"的长度为13个字符。



发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。