So I got this function:
function hosting(){
$localhostIP = array(
'127.0.0.1',
'::1'
);
if(!in_array($_SERVER['REMOTE_ADDR'], $localhostIP)){
$localhost = false;
return true;
}else{
$localhost = true;
return $localhost;
}
}
Later in the same file I want to call the function and check if the $localhost is true or false, this is what I got so far:
hosting();
if ($localhost == false) {
echo"N";
}else{
echo"Y";
}
It doesn't work and it is probably worst attempt ever, could someone show me how to check $localhost in the right way?
Thanks, Brian
$localhost = hosting()