How can I call two functions from a single call in PHP?
function 1() {
// do stuff
}
function 2() {
// do other stuff
}
Then I want to call those 2 functions from a single call
(calling_functions_1_and_2($string));
How do I go about doing this?
Elaborated:
This function strips a string of any URL's
function cleaner($url) {
$U = explode(' ',$url);
$W =array();
foreach ($U as $k => $u) {
if (stristr($u,'http') || (count(explode('.',$u)) > 1)) {
unset($U[$k]);
return cleaner( implode(' ',$U));
}
}
return implode(' ',$U);
}
This function strips a string of any special characters, etc.
function clean($string) {
return $string = preg_replace('/[^A-Za-z0-9\-\']/', '', $string); // Removes special chars.
}
The string that these functions perform on is in a JSON array.
So calling one of the functions
clean($searchResult['snippet']['title']); // wanting to remove all special characters from this string but not URL's.
But on this string below I do want to remove special characters and URLs, so how would I call both functions the most efficient and easiest way?
cleaner($searchResult['snippet']['description']);