code: public function getCookieValue($host, $path, $name)
      {
          $longest_path = '';
          foreach ($this->cookies as $cookie) {
              if ($this->isMatch($cookie, $host, $path, $name)) {
                  if (strlen($cookie->getPath()) > strlen($longest_path)) {
                      $value        = $cookie->getValue();
                      $longest_path = $cookie->getPath();
                  }
              }
          }
  
          return (isset($value) ? $value : false);
      }
docs: Reads the most specific cookie value from the browser cookies.
  Looks for the longest path that matches.
  
  @param string $host Host to search.
  @param string $path Applicable path.
  @param string $name Name of cookie to read.
  
  @return string False if not present, else the value as a string.