public static function getIp(): string
    {
        $ip = 'unknown';
        if ('' != ($ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] ?? ''))) {
            if (false !== strpos($ip, ',')) {
                $ip = trim((string) end(explode(',', $ip)));
            }
        }
        // all ok
        elseif ('' != ($ip = ($_SERVER['HTTP_CLIENT_IP'] ?? ''))) {}
        elseif ('' != ($ip = ($_SERVER['HTTP_X_REAL_IP'] ?? ''))) {}
        elseif ('' != ($ip = ($_SERVER['REMOTE_ADDR_REAL'] ?? ''))) {}
        elseif ('' != ($ip = ($_SERVER['REMOTE_ADDR'] ?? ''))) {}

        return $ip;
    }
public static function getIp(): string
    {
        $ip = 'unknown';
        if ('' != ($ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] ?? ''))) {
            if (false !== strpos($ip, ',')) {
                $ip = trim((string) end(explode(',', $ip)));
            }
        }
        // all ok
        elseif ('' != ($ip = ($_SERVER['HTTP_CLIENT_IP'] ?? ''))) {}
        elseif ('' != ($ip = ($_SERVER['HTTP_X_REAL_IP'] ?? ''))) {}
        elseif ('' != ($ip = ($_SERVER['REMOTE_ADDR_REAL'] ?? ''))) {}
        elseif ('' != ($ip = ($_SERVER['REMOTE_ADDR'] ?? ''))) {}

        return $ip;
    }
public static function getIp ( ) : string { $ ip = 'unknown' ; if ( '' != ( $ ip = ( $ _SERVER [ 'HTTP_X_FORWARDED_FOR' ] ?? '' ) ) ) { if ( false !== strpos ( $ ip , ',' ) ) { $ ip = trim ( ( string ) end ( explode ( ',' , $ ip ) ) ) ; } } // all ok elseif ( '' != ( $ ip = ( $ _SERVER [ 'HTTP_CLIENT_IP' ] ?? '' ) ) ) { } elseif ( '' != ( $ ip = ( $ _SERVER [ 'HTTP_X_REAL_IP' ] ?? '' ) ) ) { } elseif ( '' != ( $ ip = ( $ _SERVER [ 'REMOTE_ADDR_REAL' ] ?? '' ) ) ) { } elseif ( '' != ( $ ip = ( $ _SERVER [ 'REMOTE_ADDR' ] ?? '' ) ) ) { } return $ ip ; }
Get IP.
@return string
Get IP .