public static function firstHeader($message, $header)
    {
        if (!empty($message['headers'])) {
            foreach ($message['headers'] as $name => $value) {
                if (!strcasecmp($name, $header)) {
                    // Return the match itself if it is a single value.
                    $pos = strpos($value[0], ',');
                    return $pos ? substr($value[0], 0, $pos) : $value[0];
                }
            }
        }

        return null;
    }
public static function firstHeader($message, $header)
    {
        if (!empty($message['headers'])) {
            foreach ($message['headers'] as $name => $value) {
                if (!strcasecmp($name, $header)) {
                    // Return the match itself if it is a single value.
                    $pos = strpos($value[0], ',');
                    return $pos ? substr($value[0], 0, $pos) : $value[0];
                }
            }
        }

        return null;
    }
public static function firstHeader ( $ message , $ header ) { if ( ! empty ( $ message [ 'headers' ] ) ) { foreach ( $ message [ 'headers' ] as $ name => $ value ) { if ( ! strcasecmp ( $ name , $ header ) ) { // Return the match itself if it is a single value. $ pos = strpos ( $ value [ 0 ] , ',' ) ; return $ pos ? substr ( $ value [ 0 ] , 0 , $ pos ) : $ value [ 0 ] ; } } } return null ; }
Returns the first header value from a message as a string or null. If
a header line contains multiple values separated by a comma, then this
function will return the first value in the list.

@param array  $message Request or response hash.
@param string $header  Header to retrieve

@return string|null Returns the value as a string if found.
Returns the first header value from a message as a string or null . If a header line contains multiple values separated by a comma then this function will return the first value in the list .