位置: 编程技术 - 正文

PHP字符串函数strlen()的用法(在php中,字符串有哪些表示形式)

编辑:rootadmin
strlen

推荐整理分享PHP字符串函数strlen()的用法(在php中,字符串有哪些表示形式),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php string函数,php string函数,php字符串定义,php字符串型数据的定义方式,php 字符串函数,php字符串定义的三种方式,php字符串定义,php 字符串函数,内容如对您有帮助,希望把文章链接给更多的朋友!

(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 E_NOTICE level error. 范例 PHP字符串函数strlen()的用法(在php中,字符串有哪些表示形式)

Example #1 strlen() 范例

<?php$str='abcdef';echostrlen($str);//6$str='abcd';echostrlen($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() - 获取字符串的长度

PHP字符串函数stristr()的用法 stristr(PHP4,PHP5)stristrstrstr()函数的忽略大小写版本说明stringstristr(string$haystack,mixed$needle[,bool$before_needle=false])返回haystack字符串从needle第一次出现的位置开

PHP字符串函数stripos()的用法 stripos(PHP5)stripos查找字符串首次出现的位置(不区分大小写)说明intstripos(string$haystack,string$needle[,int$offset=0])返回在字符串haystack中needle首次出现的数字

PHP字符串函数stripcslashes()的用法 stripcslashes(PHP4,PHP5)stripcslashes反引用一个使用addcslashes()转义的字符串说明stringstripcslashes(string$str)返回反转义后的字符串。可识别类似C语言的n,r,...八

本文链接地址:https://www.jiuchutong.com/biancheng/278817.html 转载请保留说明!

上一篇:PHP字符串函数stripslashes()的用法(php字符串变量)

下一篇:PHP字符串函数stristr()的用法(php str函数)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络