src/Util/Net.php
public static function parseHeaders($headerstr=false) {
        if ( $headerstr === false ) $headerstr = self::getLastHeadersReceived();
        $lines = explode("\n",$headerstr);
        $headermap = array();

        foreach ($lines as $line) {
            $pos = strpos($line, ':');
            if ( $pos < 1 ) continue;
            $key = substr($line,0,$pos);
            $value = trim(substr($line, $pos+1));
            if ( strlen($key) < 1 || strlen($value) < 1 ) continue;
            $headermap[$key] = $value;
        }
        return $headermap;
    }
public static function parseHeaders($headerstr=false) {
        if ( $headerstr === false ) $headerstr = self::getLastHeadersReceived();
        $lines = explode("\n",$headerstr);
        $headermap = array();

        foreach ($lines as $line) {
            $pos = strpos($line, ':');
            if ( $pos < 1 ) continue;
            $key = substr($line,0,$pos);
            $value = trim(substr($line, $pos+1));
            if ( strlen($key) < 1 || strlen($value) < 1 ) continue;
            $headermap[$key] = $value;
        }
        return $headermap;
    }
public static function parseHeaders ( $ headerstr = false ) { if ( $ headerstr === false ) $ headerstr = self :: getLastHeadersReceived ( ) ; $ lines = explode ( "\n" , $ headerstr ) ; $ headermap = array ( ) ; foreach ( $ lines as $ line ) { $ pos = strpos ( $ line , ':' ) ; if ( $ pos < 1 ) continue ; $ key = substr ( $ line , 0 , $ pos ) ; $ value = trim ( substr ( $ line , $ pos + 1 ) ) ; if ( strlen ( $ key ) < 1 || strlen ( $ value ) < 1 ) continue ; $ headermap [ $ key ] = $ value ; } return $ headermap ; }
Extract a set of header lines into an array

Takes a newline separated header sting and returns a key/value array
Extract a set of header lines into an array