I need to find one of the three words even if written at the beginning of the string and not just in the middle or at the end. This is my code:
<?php
$string = "one test";
$words = array( 'one', 'two', 'three' );
foreach ( $words as $word ) {
if ( stripos ( $string, $word) ) {
echo 'found<br>';
} else {
echo 'not found<br>';
}
}
?>
If $string is "one test" the search fails; if $string is "test one" the search is good.
Thank you!