Re: cvs: pear /HTTP_Header Header.php

From: Date: Tue, 09 Dec 2003 19:22:02 +0000
Subject: Re: cvs: pear /HTTP_Header Header.php
References: 1 2  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-14741@lists.php.net to get a copy of this message
i appreciate it. but i dont know if that really optimizes it for the realistic number of headers you normally set, like 1 to approx. 10. I think the array_* functions might produce the same performance loss ... even though you are right for may be thousands of headers i think that would make sense ... am i right? Pierre-Alain Joye wrote:
While I'm reading ;-) that optimize a little bit the inner loop: function setHeaders($keys=null) { if (is_array($this->_headers)) { // Dunno if that can occur ;) $gkeys = array_keys($this->_headers); if (is_array($keys)) { $rkeys = array_intersect($gkeys, $keys); } else { $rkeys = $gkeys; } foreach ($rk as $k) { header("$k: ".$this->_headers[$k]); } } } On Tue, 09 Dec 2003 18:49:41 -0000 "Wolfram Kriesing" <cain@php.net> wrote:
@@ -154,8 +154,10 @@
    function sendHeaders($keys=array())
function sendHeaders($keys=null)
    {
        foreach ($this->_headers as $key=>$value) {
-            if ($keys && in_array($key,$keys))  {
-                header("$key: $value");
+            if ($keys) {
+                if (in_array($key,$keys))  {
+                    header("$key: $value");
+                }
            } else {
                header("$key: $value");
            }
-- PEAR CVS Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Wolfram http://opensource.visionp.de ... authentication system .... http://sf.net/projects/auth

« previous php.pear.cvs (#14741) next »