Check if string contains word in array [duplicate]
1) The simplest way:
if ( in_array( 'three', ['one', 'three', 'seven'] ))...
2) Another way (while checking arrays towards another arrays):
$keywords=array('one','two','three');$targets=array('eleven','six','two');foreach ( $targets as $string ) { foreach ( $keywords as $keyword ) { if ( strpos( $string, $keyword ) !== FALSE ) { echo "The word appeared !!" } }}