13 "Two: header\n\tlines\n",
14 "Three",": header\n lines\n here\n",
15 "More: than one header\n",
16 "More: ", "than: ", "you: ", "expect\n",
20 $states = array(-1=>"FAILURE",0=>"START","KEY","VALUE","VALUE_EX","HEADER_DONE","DONE");
21 $parser = new http\Header\Parser;
23 $state = $parser->parse($part = array_shift($headers),
24 $headers ? 0 : http\Header\Parser::CLEANUP,
26 printf("%2\$-32s | %1\$s\n", $states[$state], addcslashes($part, "\r\n\t\0"));
27 } while ($headers && $state !== http\Header\Parser::STATE_FAILURE);
37 Two: header\n\tlines\n | VALUE_EX
39 : header\n lines\n here\n | VALUE_EX
40 More: than one header\n | VALUE_EX
50 string(12) "header lines"
52 string(17) "header lines here"
56 string(15) "than one header"
58 string(17) "than: you: expect"