function cleaner($url) { $U = explode(' ', $url); $contains = false; $W = array(); foreach ($U as $k => $u) { if (stristr($u, ".")) { //only preg_match if there is a dot if (containsTLD($u) === true) { $contains = true; } } } return $contains; }
function cleaner($url) { $U = explode(' ', $url); $W = array(); foreach ($U as $k => $u) { if (stristr($u, ".")) { //only preg_match if there is a dot if (containsTLD($u) === true) { unset($U[$k]); return cleaner(implode(' ', $U)); } } } return implode(' ', $U); }