I would reuse a variable $spider_flag
inside static function to include in other static function. How to do that ?
TK
public static function start() {
$spider_flag = false;
if (!empty($user_agent) || strpos ($user_agent, "Googlebot") > 0) {
$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (!empty($user_agent)) {
foreach (file(Sites/Assets/spiders.txt') as $spider) {
if (!empty($spider)) {
if (strpos($user_agent, $spider) !== false) {
$wo_full_name = $spider;
$spider_flag = true;
break;
}
}
}
}
}
the other function
public static function getResultSpiderFlag() {
$spider_flag= ????
return $spider_flag;
}