public function QueryPath::textImplode in QueryPath 6
Same name and namespace in other branches
- 7.3 QueryPath/QueryPath.php \QueryPath::textImplode()
- 7.2 QueryPath/QueryPath.php \QueryPath::textImplode()
File
- QueryPath/
QueryPath.php, line 1234
Class
Code
public function textImplode($sep = ', ', $filterEmpties = TRUE) {
$tmp = array();
foreach ($this->matches as $m) {
$txt = $m->textContent;
$trimmed = trim($txt);
if ($filterEmpties) {
if (strlen($trimmed) > 0) {
$tmp[] = $txt;
}
}
else {
$tmp[] = $txt;
}
}
return implode($sep, $tmp);
}