Re: Check if string contains matched words.



Leigh Finch wrote:

if(strpos($string_to_match, rtrim($word)) !== false) {
$match = true;
}

It can be better to use stripos(), that way you haven't have to includ in the file a million different ways to type the same word.

I do personally prefer to use trim(), you never know what another person will do when they fill the file, could be they want to have some kind of indentation.


--

//Aho
.



Relevant Pages

  • Re: Check if string contains matched words.
    ... J.O. Aho wrote: ... It can be better to use stripos(), that way you haven't have to includ in the file a million different ways to type the same word. ... Leigh Finch ...
    (alt.php)
  • Check if string contains matched words.
    ... It can be better to use stripos(), that way you haven't have to includ ... I do personally prefer to use trim(), you never know what another person ... Leigh Finch ...
    (alt.php)