PHP get words with length longer than 3 from string -
is there function can cut words string small length e.g. "the, and, you, me, or" these short words common in sentences. want use function fill fulltext search criteria
before method:
$fulltext = "there ongoing work on creating formal php specification.";
outcome:
$fulltext_method_solution = "there ongoing work creating formal specification."
$fulltext = "there ongoing work on creating formal php specification."; $words = array_filter(explode(' ', $fulltext), function($val){ return strlen($val) > 3; // filter words having length > 3 in array }); $fulltext_method_solution = implode(' ', $words); // join words sentence
Comments
Post a Comment