(, / ), , , - :
$keywords = array(
'great',
'leather',
'shoes'
);
$titles = array(
'Get Some Really Great Leather Shoes',
'Leather Shoes Are Great',
'Great Day! Those Are Some Cool Leather Shoes!',
'Shoes, Made of Leather, Can Be Great',
'Leather Shoes on Sale Today!',
'You\'ll Love These Leather Shoes Greatly',
'Great Shoes Don\'t Come Cheap'
);
$matches = array();
foreach( $titles as $title )
{
$wordsInTitle = preg_split( '~\b(\W+\b)?~', $title, null, PREG_SPLIT_NO_EMPTY );
if( array_uintersect( $keywords, $wordsInTitle, 'strcasecmp' ) == $keywords )
{
$matches[] = $title;
}
}
var_dump( $matches );
, .