
字符串
小悲伤.LQ
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
linux环境去空格PHP开发
开发环境是window,正式环境是linux,当时开发是去除字符串两边的空格,和数组匹配,开发环境没问题,上线到正式环境就匹配不到,后面发现是window的去空格在linux不适用, window: $str = str_replace(PHP_EOL, '', $str); $data = str_replace(' ', "", $data); linux: $str = preg_replace("/(\s|\ \;| |\xc2\xa0)/","",$str); ...原创 2022-01-18 16:58:13 · 507 阅读 · 0 评论 -
php计算字符串在字符串中出现的次数substr_count()
php计算字符串在字符串中出现的次数substr_count() 废话不多说,直接上代码: $str = "abcdchg" $num = substr_count($str,'c'); echo $num; 输出结果为:2原创 2020-11-12 18:37:19 · 185 阅读 · 0 评论