码迷,mamicode.com
首页 > 其他好文 > 详细

检查字符串是否存在

时间:2019-06-18 12:27:07      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:targe   turn   res   UNC   ==   tar   检查   stat   str   

/**
     * 查看字符是否存在
     * @param $str
     * @param $target
     * @return bool
     */
    public static function checkStrExist($str,$target) {
        $res = strpos($str,$target); // 目标第一次出现的位置,第一位为0 没发现,返回false
        if ($res === false) { // 恒等于false
            return false;
        } else {
            return true;
        }
    }

检查字符串是否存在。

检查字符串是否存在

标签:targe   turn   res   UNC   ==   tar   检查   stat   str   

原文地址:https://www.cnblogs.com/jiqing9006/p/11044311.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!