3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Some test text string with stop-words: stw stw2 stopword stw3stw stopword2c"; $stopwords = array( 'stw', 'stopword' ); $regexp = '/'; $regexp.= '(' . implode('|', $stopwords) . ')' . '/'; var_dump($regexp);

preferences:
32.84 ms | 402 KiB | 5 Q