![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
小悲伤.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 · 465 阅读 · 0 评论 -
php计算字符串在字符串中出现的次数substr_count()
php计算字符串在字符串中出现的次数substr_count() 废话不多说,直接上代码: $str = "abcdchg" $num = substr_count($str,'c'); echo $num; 输出结果为:2原创 2020-11-12 18:37:19 · 129 阅读 · 0 评论