Probiers doch mal so in etwa:
class StringClass {
var $words = array('<a', '\[link', '\[url');
var $wordsLength;
var $out;
var $punkte = 0;
function iniString() {
$this->wordsLength = count($this->words);
}
function checkString($data) {
$this->iniString();
for($i=0; $i<$this->wordsLength; $i++){
if(preg_match('/'.$data.'/',$this->words[$i])==true){
$this->punkte++;
}
}
$this->out = "Ihr Eintrag enthält ".$this->punkte." von den ".$this->wordsLength." verbotenen Wörtern! Bitte löschen Sie diese.";
}
function Output() {
echo $this->out;
}
}
$text = "<a test test";
$check = new StringClass();
$check->checkString($text);
$check->Output();
Hoffe es hilft. Grüße.