- var_export: documentation ( source)
- preg_grep: documentation ( source)
<?php
$stopwords = "bed|badword|bud";
$lines = [
'Good morning everyone',
'Make your bed and brush your hair',
'Finish your breakfast',
'Do not say badwords',
'Will you be my buddy?',
];
var_export(preg_grep("#$stopwords#", $lines));