roundcubemail/program/lib/Roundcube/rcube_mime.php
public static function parse_headers($headers)
    {
        $a_headers = array();
        $headers   = preg_replace('/\r?\n(\t| )+/', ' ', $headers);
        $lines     = explode("\n", $headers);
        $count     = count($lines);

        for ($i=0; $i<$count; $i++) {
            if ($p = strpos($lines[$i], ': ')) {
                $field = strtolower(substr($lines[$i], 0, $p));
                $value = trim(substr($lines[$i], $p+1));
                if (!empty($value)) {
                    $a_headers[$field] = $value;
                }
            }
        }

        return $a_headers;
    }
public static function parse_headers($headers)
    {
        $a_headers = array();
        $headers   = preg_replace('/\r?\n(\t| )+/', ' ', $headers);
        $lines     = explode("\n", $headers);
        $count     = count($lines);

        for ($i=0; $i<$count; $i++) {
            if ($p = strpos($lines[$i], ': ')) {
                $field = strtolower(substr($lines[$i], 0, $p));
                $value = trim(substr($lines[$i], $p+1));
                if (!empty($value)) {
                    $a_headers[$field] = $value;
                }
            }
        }

        return $a_headers;
    }
public static function parse_headers ( $ headers ) { $ a_headers = array ( ) ; $ headers = preg_replace ( '/\r?\n(\t| )+/' , ' ' , $ headers ) ; $ lines = explode ( "\n" , $ headers ) ; $ count = count ( $ lines ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { if ( $ p = strpos ( $ lines [ $ i ] , ': ' ) ) { $ field = strtolower ( substr ( $ lines [ $ i ] , 0 , $ p ) ) ; $ value = trim ( substr ( $ lines [ $ i ] , $ p + 1 ) ) ; if ( ! empty ( $ value ) ) { $ a_headers [ $ field ] = $ value ; } } } return $ a_headers ; }
Split RFC822 header string into an associative array
Split RFC822 header string into an associative array