PHP头条
热点:

php除了字符串


php 去掉字符串

今天项目中用到,去掉字符串中的最后一个字符

原字符串1,2,3,4,5,6, 去掉最后一个字符",",最终结果为1,2,3,4,5,6 代码如下: $str = "1,2,3,4,5,6,"; $newstr = substr($str,0,strlen($str)-1); echo $newstr; 系统自带的函数也可实现这样的效果,两种方法: 1) substr($str, 0, -1) 2)rtrim($str, ",")

www.phpzy.comtrue/phprm/24398.htmlTechArticlephp除了字符串 php 去掉字符串 今天项目中用到,去掉字符串中的最后一个字符 原字符串1,2,3,4,5,6,去掉最后一个字符",",最终结果为1,2,3,4,5,6代码如下: $str = "1,2,3,4,5,6,"; $newstr = substr($...

相关文章

PHP之友评论

今天推荐