Check if it is on local host or server

 Check if it is Localhost or server:
function is_localhost() 
{ 
    $whitelist = array( '127.0.0.1', '::1' ); 

    return in_array( $_SERVER['REMOTE_ADDR'], $whitelist); 
}


just call the function LIke,

$isLocalhost = is_localhost();

echo $isLocalhost;

Leave a Reply

Your email address will not be published. Required fields are marked *