code: public static function getPort()
      {
          $port = 0;
          if (isset($_SERVER['SERVER_PORT'])) {
              $port = intval($_SERVER['SERVER_PORT']);
          }
          if ($port == 0) {
              $port = self::getStandardPort();
          }
          return $port;
      }
docs: Get port (default 80).
  
  @return integer