note 77241 added to function.http-parse-headers

From: Date: Tue, 21 Aug 2007 11:45:16 +0000
Subject: note 77241 added to function.http-parse-headers
Groups: php.notes 
Request: Send a blank email to php-notes+get-129668@lists.php.net to get a copy of this message
This one works better: <?php function http_parse_headers( $header ) { $retVal = array(); $fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header)); foreach( $fields as $field ) { if( preg_match('/([^:]+): (.+)/m', $field, $match) ) { $match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1]))); if( isset($retVal[$match[1]]) ) { $retVal[$match[1]] = array($retVal[$match[1]], $match[2]); } else { $retVal[$match[1]] = trim($match[2]); } } } return $retVal; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 212.95.103.219 ---- Manual Page -- http://www.php.net/manual/en/function.http-parse-headers.php Edit -- https://master.php.net/note/edit/77241 Del: integrated -- https://master.php.net/note/delete/77241/integrated Del: useless -- https://master.php.net/note/delete/77241/useless Del: bad code -- https://master.php.net/note/delete/77241/bad+code Del: spam -- https://master.php.net/note/delete/77241/spam Del: non-english -- https://master.php.net/note/delete/77241/non-english Del: in docs -- https://master.php.net/note/delete/77241/in+docs Del: other reasons-- https://master.php.net/note/delete/77241 Reject -- https://master.php.net/note/reject/77241 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129668) next »