src/includes/classes/Core/Utils/Ip.php
public function country(string $ip): string
    {
        if (!empty($_SERVER['HTTP_CF_IPCOUNTRY']) // Save time.
            && $ip === $_SERVER['HTTP_CF_CONNECTING_IP'] ?? '' && $ip === $this->current()
            && mb_strlen((string) $_SERVER['HTTP_CF_IPCOUNTRY']) === 2) {
            return (string) $_SERVER['HTTP_CF_IPCOUNTRY'];
        } // This saves time by using CloudFlare.

        if (($geo = $this->geoData($ip))) {
            return $geo->country;
        }
        return ''; // Failure.
    }
public function country(string $ip): string
    {
        if (!empty($_SERVER['HTTP_CF_IPCOUNTRY']) // Save time.
            && $ip === $_SERVER['HTTP_CF_CONNECTING_IP'] ?? '' && $ip === $this->current()
            && mb_strlen((string) $_SERVER['HTTP_CF_IPCOUNTRY']) === 2) {
            return (string) $_SERVER['HTTP_CF_IPCOUNTRY'];
        } // This saves time by using CloudFlare.

        if (($geo = $this->geoData($ip))) {
            return $geo->country;
        }
        return ''; // Failure.
    }
Country code for IP address.

@since 150424 Initial release.

@param string $ip An IP address.

@return string Country code for IP address.