- preg_match_all: documentation ( source)
- implode: documentation ( source)
<?php
$blacklist = ['fu', 'bar'];
$input = 'benutzer Eingabe fu bar';
$count = preg_match_all('/(' . implode('|', $blacklist) . ')/i', $input, $matches);
If ($count > 0) {
echo 'Böse Wörter: ' . implode(', ', $matches[0]);
}