3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function parseStopWords($text){ $text = preg_replace('/[^a-zA-Z0-9áéíóúñ\',]/i','',$text); $stopwords = array('a','ante','bajo','cabe','con','contra','de','desde','en','entre','hacia','hasta','para','por','sin','sobre','tras','el','lo','la','los','las','un','unos','una','al','del','que','es','se','y','fue'); foreach($stopwords as $w){ $text = preg_replace('/\b'.$w.'\b/i','',$text); } $text = preg_replace('/\s{2,}/i',' ',$text); return $text; } $texto = "Prueba de parseStop worlds para probar la prueba"; var_dump(parseStopWords($texto));
Output for 4.3.0 - 7.1.0
string(41) "PruebadeparseStopworldsparaprobarlaprueba"