note 78601 added to function.http-parse-headers

From: Date: Thu, 18 Oct 2007 18:12:34 +0000
Subject: note 78601 added to function.http-parse-headers
Groups: php.notes 
Request: Send a blank email to php-notes+get-131514@lists.php.net to get a copy of this message
small addition for user at example dot net <?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]]) ) { if (is_array($retVal[$match[1]])) { array_push($retVal[$match[1]], $match[2]); } else { $retVal[$match[1]] = array($retVal[$match[1]], $match[2]); } } else { $retVal[$match[1]] = trim($match[2]); } } } return $retVal; } ?> ---- Server IP: 195.54.192.44 Probable Submitter: 81.222.191.235 ---- Manual Page -- http://www.php.net/manual/en/function.http-parse-headers.php Edit -- https://master.php.net/note/edit/78601 Del: integrated -- https://master.php.net/note/delete/78601/integrated Del: useless -- https://master.php.net/note/delete/78601/useless Del: bad code -- https://master.php.net/note/delete/78601/bad+code Del: spam -- https://master.php.net/note/delete/78601/spam Del: non-english -- https://master.php.net/note/delete/78601/non-english Del: in docs -- https://master.php.net/note/delete/78601/in+docs Del: other reasons-- https://master.php.net/note/delete/78601 Reject -- https://master.php.net/note/reject/78601 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131514) next »