src/net/http/HttpRequest.php
public function addHeader($name, $value) {
        if (!is_string($name))  throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if (!strlen($name))     throw new InvalidArgumentException('Invalid argument $name: '.$name);

        if (!is_string($value)) throw new IllegalTypeException('Illegal type of parameter $value: '.gettype($value));
        if (!strlen($value))    throw new InvalidArgumentException('Invalid argument $value: '.$value);

        $name  = trim($name);
        $value = trim($value);

        // memorize and drop existing headers of the same name (ignore case)
        $existing = \array_intersect_ukey($this->headers, [$name => '1'], 'strCaseCmp');
        foreach ($existing as $key => $v) {
            unset($this->headers[$key]);
        }

        // combine existing and new header (see RFC), set combined header
        $existing[] = $value;
        $this->headers[$name] = join(', ', $existing);

        return $this;
    }
public function addHeader($name, $value) {
        if (!is_string($name))  throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if (!strlen($name))     throw new InvalidArgumentException('Invalid argument $name: '.$name);

        if (!is_string($value)) throw new IllegalTypeException('Illegal type of parameter $value: '.gettype($value));
        if (!strlen($value))    throw new InvalidArgumentException('Invalid argument $value: '.$value);

        $name  = trim($name);
        $value = trim($value);

        // memorize and drop existing headers of the same name (ignore case)
        $existing = \array_intersect_ukey($this->headers, [$name => '1'], 'strCaseCmp');
        foreach ($existing as $key => $v) {
            unset($this->headers[$key]);
        }

        // combine existing and new header (see RFC), set combined header
        $existing[] = $value;
        $this->headers[$name] = join(', ', $existing);

        return $this;
    }
public function addHeader ( $ name , $ value ) { if ( ! is_string ( $ name ) ) throw new IllegalTypeException ( 'Illegal type of parameter $name: ' . gettype ( $ name ) ) ; if ( ! strlen ( $ name ) ) throw new InvalidArgumentException ( 'Invalid argument $name: ' . $ name ) ; if ( ! is_string ( $ value ) ) throw new IllegalTypeException ( 'Illegal type of parameter $value: ' . gettype ( $ value ) ) ; if ( ! strlen ( $ value ) ) throw new InvalidArgumentException ( 'Invalid argument $value: ' . $ value ) ; $ name = trim ( $ name ) ; $ value = trim ( $ value ) ; // memorize and drop existing headers of the same name (ignore case) $ existing = \ array_intersect_ukey ( $ this -> headers , [ $ name => '1' ] , 'strCaseCmp' ) ; foreach ( $ existing as $ key => $ v ) { unset ( $ this -> headers [ $ key ] ) ; } // combine existing and new header (see RFC), set combined header $ existing [ ] = $ value ; $ this -> headers [ $ name ] = join ( ', ' , $ existing ) ; return $ this ; }
Add an HTTP header to the existing ones. Existing headers of the same name are not overwritten.

@param  string $name  - header name
@param  string $value - header value

@return $this

@see http://stackoverflow.com/questions/3241326/set-more-than-one-http-header-with-the-same-name
Add an HTTP header to the existing ones . Existing headers of the same name are not overwritten .