How to find full words only in string
Or use RegExpr:
$str = "The text in the first post"; $search = "first"; if( preg_match('/\b'.$search.'\b/', $str) ) { echo 'FOUND!'; }