Sentence 1 pulls the word "jazz" and sentence 2 does the same. How can I setup the array or foreach so it can search for "Word AND Word" and not "Word OR Word"
//THIS WILL PULL "JAZZ"
$sentence1 = "My buddy plays the trumpet while I'm jamming with a flute.";
//THIS WILL PULL "JAZZ"
$sentence2 = "My neighbor sold me his trumpet.";
$niches = array(
'jazz'=>array(
'jazz',
'trumpet',
'drums',
'flute'
),
);
foreach( $niches as $singer=>$songs )
{
asort( $songs );
foreach( $songs as $song )
{
if (!strpos($sentence1, $song) === false) {
$niche = $singer;
}
}
}