run code in 200+ php & hhvm versions
Bugs & Features
<?php $articles = "Maybe it’s less true than it used to be that people are made of place--that the same elements that form coal and clay and bogs and ice form faces, voices and characters. I wrote my first collection of short stories, The Bostons, in homage to this book, hoping, as did Joyce’s young Stephen Dedalus, to encounter for the millionth time the reality of experience and to forge in the smithy of my soul the uncreated conscience of some island-dwellers I knew."; $keywords = "less true than, people are made, smithy of my soul, uncreated conscience, this is a test string"; $keywordsArray = explode(', ',$keywords); $pattern = '/'.implode('|',$keywordsArray).'/'; preg_match_all($pattern,$articles,$matches); var_dump($matches);
Output for 4.3.0 - 7.2.0
array(1) { [0]=> array(4) { [0]=> string(14) "less true than" [1]=> string(15) "people are made" [2]=> string(17) "smithy of my soul" [3]=> string(20) "uncreated conscience" } }