src/net/mail/Mailer.php
protected function removeHeader(array &$headers, $name) {
        if (!is_string($name))                           throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if (!preg_match('/^[a-z]+(-[a-z]+)*$/i', $name)) throw new InvalidArgumentException('Invalid parameter $name: "'.$name.'"');

        $result = null;

        foreach ($headers as $i => $header) {
            if (strStartsWithI($header, $name.':')) {
                $result = trim(substr($header, strlen($name)+1));
                unset($headers[$i]);
            }
        }
        return $result;
    }
protected function removeHeader(array &$headers, $name) {
        if (!is_string($name))                           throw new IllegalTypeException('Illegal type of parameter $name: '.gettype($name));
        if (!preg_match('/^[a-z]+(-[a-z]+)*$/i', $name)) throw new InvalidArgumentException('Invalid parameter $name: "'.$name.'"');

        $result = null;

        foreach ($headers as $i => $header) {
            if (strStartsWithI($header, $name.':')) {
                $result = trim(substr($header, strlen($name)+1));
                unset($headers[$i]);
            }
        }
        return $result;
    }
protected function removeHeader ( array & $ headers , $ name ) { if ( ! is_string ( $ name ) ) throw new IllegalTypeException ( 'Illegal type of parameter $name: ' . gettype ( $ name ) ) ; if ( ! preg_match ( '/^[a-z]+(-[a-z]+)*$/i' , $ name ) ) throw new InvalidArgumentException ( 'Invalid parameter $name: "' . $ name . '"' ) ; $ result = null ; foreach ( $ headers as $ i => $ header ) { if ( strStartsWithI ( $ header , $ name . ':' ) ) { $ result = trim ( substr ( $ header , strlen ( $ name ) + 1 ) ) ; unset ( $ headers [ $ i ] ) ; } } return $ result ; }
Remove a given header from the array and return its value. If the array contains multiple headers of that name all
such headers are removed and the last removed one is returned.

@param  string[] $headers - reference to an array of headers
@param  string   $name    - header to remove

@return string|null - value of the last removed header or NULL if the header was not found
Remove a given header from the array and return its value . If the array contains multiple headers of that name all such headers are removed and the last removed one is returned .