strchr()的用法
生活随笔
收集整理的這篇文章主要介紹了
strchr()的用法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
strchr()主要有2個最有用的用法:
第一個:搜索字符串在另一字符串中的第一次出現。并返回剩余的部分
$str = "hello_chrdai_1993"; $not_include_hello = strchr($str,'_'); echo $not_include_hello; // _chrdai_1993
第一個:搜索字符串在另一字符串中的第一次出現。并返回第一次出現之前的字符串部分
$str = "hello_chrdai_1993"; $not_include_hello = strchr($str,'_',true); // 注意,此處加了一個參數 true, php > 5.3 才能用這個參數 echo $not_include_hello; // hello
本文為我工作中記錄的收獲,如有轉載,請注明出處:http://www.cnblogs.com/chrdai/p/7241384.html
總結
以上是生活随笔為你收集整理的strchr()的用法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: dnf暗能量哪里有送
- 下一篇: 12月4日法制宣传日(12月4日法制宣传