src/net/mail/Mailer.php
protected function getHeader(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.'"');

        // reversely iterate over the array to find the last of duplicate headers
        for (end($headers); key($headers)!==null; prev($headers)){
            $header = current($headers);
            if (strStartsWithI($header, $name.':'))
                return trim(substr($header, strlen($name)+1));
        }
        return null;
    }
protected function getHeader(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.'"');

        // reversely iterate over the array to find the last of duplicate headers
        for (end($headers); key($headers)!==null; prev($headers)){
            $header = current($headers);
            if (strStartsWithI($header, $name.':'))
                return trim(substr($header, strlen($name)+1));
        }
        return null;
    }
protected function getHeader ( 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 . '"' ) ; // reversely iterate over the array to find the last of duplicate headers for ( end ( $ headers ) ; key ( $ headers ) !== null ; prev ( $ headers ) ) { $ header = current ( $ headers ) ; if ( strStartsWithI ( $ header , $ name . ':' ) ) return trim ( substr ( $ header , strlen ( $ name ) + 1 ) ) ; } return null ; }
Search for a given header and return its value. If the array contains multiple headers of that the last such header
is returned.

@param  string[] $headers - array of headers
@param  string   $name    - header to search for

@return string|null - value of the last found header or NULL if the header was not found
Search for a given header and return its value . If the array contains multiple headers of that the last such header is returned .