PHP - Wörter mit der Stoppwortliste filtern

Diese Liste enthält Wörter die aus einem Satz heraus gefiltert werden können. Es handelt sich dabei um keine vollständige Liste, Eigennamen müssen extra hinzugefügt werden.


<?php

// Wörter mit der Stoppwortliste filtern

$stoppwortliste = array("aber","alle","allen","alles","als","also","andere","anderem","anderer",
"anderes","anders","auch","auf","aus","ausser","ausserdem","bei","beide","beiden",
"beides","beim","bereits","bestehen","besteht","bevor","bin","bis","bloss","bloß","brauchen",
"braucht","dabei","dadurch","dagegen","daher","damit","danach","dann","darf",
"darüber","darum","darunter","das","dass","daß","davon","dazu","dem","den","denn","der",
"des","deshalb","dessen","die","dies","diese","diesem","diesen","dieser","dieses","doch",
"dort","dürfen","durch","durfte","durften","ebenfalls","ebenso","ein","eine","einem",
"einen","einer","eines","einige","einiges","einig","entweder","erst","erste","ersten","etwa",
"etwas","falls","fast","ferner","folgender","folglich","für","ganz","geben","gegen","gehabt",
"gekonnt","gemäss","gemäß","getan","gewesen","gewollt","geworden","gibt","habe","haben",
"hätte","hätten","hallo","hat","hatte","hatten","heraus","herein","hier","hin","hinein","hinter",
"ich","ihm","ihn","ihnen","ihr","ihre","ihrem","ihren","ihres","immer","indem","infolge","innen",
"innerhalb","ins","inzwischen","irgend","irgendwas","irgendwen","irgendwer","irgendwie","irgendwo",
"ist","jede","jedem","jeden","jeder","jedes","jedoch","jene","jenem","jenen","jener","jenes",
"kann","kein","keine","keinem","keinen","keiner","keines","können","könnte","könnten","konnte",
"konnten","künftig","leer","machen","macht","machte","machten","man","mehr",
"mein","meine","meinen","meinem","meiner","meist","meiste","meisten","mich","mit","möchte",
"möchten","müssen","müssten","muss","musste","mussten","nach",
"nachdem","nacher","nämlich","neben","nein","nicht","nichts","noch","nützt","nur",
"nutzt","obgleich","obwohl","oder","ohne","per","pro","rund","schon","sehr","seid","sein",
"seine","seinem","seiner","seit","seitdem","seither","selber","sich","sie","siehe","sind","sobald",
"solange","solch","solche","solchem","solchen","solcher","solches","soll","sollen","sollte","sollten",
"somit","sondern","soweit","sowie","später","stets","such","über","ums","und","uns",
"unser","unsere","unserem","unseren","viel","viele","vollständig","vom","von","vor","vorbei",
"vorher","vorüber","während","wäre","wären","wann","war","waren","warum",
"was","wegen","weil","weiter","weitere","weiterem","weiteren","weiterer","weiteres","wem",
"wen","wenigstens","wenn","wenngleich","wer","werde","werden","weshalb","wessen","wie",
"wieder","will","wir","wird","wodurch","wohin","wollen","wollte","wollten","worin",
"würde","würden","wurde","wurden","zufolge","zum","zusammen","zur","zwar",
"zwischen");

$string "eine erfahrung kann man machen, nicht kaufen.";
$string str_replace(array("."","";"":""-"), ""$string);

foreach (
$stoppwortliste as $element) {
 
$string str_replace(" " $element " "" ",  " " $string " ");
}
echo 
$string// erfahrung kaufen
?>

Bausteine

Eine zufällige Auswahl von „Bausteinen” aus den Bereichen CSS, PHP, JavaScript und MySQL.

CSS - Mit import mehrere CSS-Dateien zusammenfassen

PHP - Bild proportional zur Breite verkleinern

JavaScript - Meldung mit Format

MySQL - Datensatz Wert erhöhen