note 70810 added to function.apache-request-headers

From: Date: Sun, 29 Oct 2006 17:01:11 +0000
Subject: note 70810 added to function.apache-request-headers
Groups: php.notes 
Request: Send a blank email to php-notes+get-119230@lists.php.net to get a copy of this message
I didn't found a replacement for apache_request_headers() in PHP::Compat (http://pear.php.net/package/PHP_Compat) so I wrote my own: <?php if( !function_exists('apache_request_headers') ) { /// function apache_request_headers() { $arh = array(); $rx_http = '/\AHTTP_/'; foreach($_SERVER as $key => $val) { if( preg_match($rx_http, $key) ) { $arh_key = preg_replace($rx_http, '', $key); $rx_matches = array(); // do some nasty string manipulations to restore the original letter case // this should work in most cases $rx_matches = explode('_', $arh_key); if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) { foreach($rx_matches as $ak_key => $ak_val) $rx_matches[$ak_key] = ucfirst($ak_val); $arh_key = implode('-', $rx_matches); } $arh[$arh_key] = $val; } } return( $arh ); } /// } /// ?> ---- Server IP: 212.124.37.9 Probable Submitter: 84.245.169.40 ---- Manual Page -- http://www.php.net/manual/en/function.apache-request-headers.php Edit -- https://master.php.net/note/edit/70810 Del: integrated -- https://master.php.net/note/delete/70810/integrated Del: useless -- https://master.php.net/note/delete/70810/useless Del: bad code -- https://master.php.net/note/delete/70810/bad+code Del: spam -- https://master.php.net/note/delete/70810/spam Del: non-english -- https://master.php.net/note/delete/70810/non-english Del: in docs -- https://master.php.net/note/delete/70810/in+docs Del: other reasons-- https://master.php.net/note/delete/70810 Reject -- https://master.php.net/note/reject/70810 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119230) next »