configuration['settings']; if (empty($words)) { return $string; } array_walk($words, 'preg_quote'); return preg_replace( array( '/\s(' . implode('|', $words) . ')\s+/i', '/^(' . implode('|', $words) . ')\s+/i', ), array( ' ', '', ), $string ); } }