How to find full words only in string

前端 未结 5 1764
臣服心动
臣服心动 2020-12-21 00:44

How to find full words only in string



        
5条回答
  •  没有蜡笔的小新
    2020-12-21 01:18

    Or use RegExpr:

    $str = "The text in the first post";
    $search = "first";
    if( preg_match('/\b'.$search.'\b/', $str) ) {
      echo 'FOUND!';
    }
    

提交回复
热议问题