public static function isHTTPS($server = array())
    {

        $response = false;

        if (empty($server) && isset($_SERVER)) {
            $server = $_SERVER;
            if (!isset($server['SERVER_PORT'])) {
                $server['SERVER_PORT'] = 80;
            }
        } else {
            $server['HTTPS'] = getenv('HTTPS');
            $server['SERVER_PORT'] = getenv('SERVER_PORT');
        }

        if (isset($server['HTTPS']) && $server['HTTPS'] !== 'off'
            || $server['SERVER_PORT'] == 443
        ) {
            $response = true;
        }

        return $response;
    }
public static function isHTTPS($server = array())
    {

        $response = false;

        if (empty($server) && isset($_SERVER)) {
            $server = $_SERVER;
            if (!isset($server['SERVER_PORT'])) {
                $server['SERVER_PORT'] = 80;
            }
        } else {
            $server['HTTPS'] = getenv('HTTPS');
            $server['SERVER_PORT'] = getenv('SERVER_PORT');
        }

        if (isset($server['HTTPS']) && $server['HTTPS'] !== 'off'
            || $server['SERVER_PORT'] == 443
        ) {
            $response = true;
        }

        return $response;
    }
public static function isHTTPS ( $ server = array ( ) ) { $ response = false ; if ( empty ( $ server ) && isset ( $ _SERVER ) ) { $ server = $ _SERVER ; if ( ! isset ( $ server [ 'SERVER_PORT' ] ) ) { $ server [ 'SERVER_PORT' ] = 80 ; } } else { $ server [ 'HTTPS' ] = getenv ( 'HTTPS' ) ; $ server [ 'SERVER_PORT' ] = getenv ( 'SERVER_PORT' ) ; } if ( isset ( $ server [ 'HTTPS' ] ) && $ server [ 'HTTPS' ] !== 'off' || $ server [ 'SERVER_PORT' ] == 443 ) { $ response = true ; } return $ response ; }
Function to check if the Server is on HTTPS or not

You can precise a server configuration (useful if you need to check an external server Params)

@param array $server

@return bool
Function to check if the Server is on HTTPS or not