[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: $_ENV vs $_SERVER in LoggerOptionConverter Michael Schmitz Fri Aug 03 06:04:17 2007

>>>>> "Knut" == Knut Urdalen <[EMAIL PROTECTED]> writes:

    Knut> Michael Schmitz wrote:
    >> As regards $_ENV superglobal, depending on php.ini (parameter
    >> variables_order) this variable may or may not be prefilled. In my
    >> opinion we should not to much on php.ini and therefore should use
    >> getenv() instead of at least in addition to $_ENV.

    Knut> One thing about getenv(). I remember running into a
    Knut> performance issue regarding getenv() and PEAR::Date
    Knut> earlier. My code produced quite a lot of Date-objects and
    Knut> PEAR::Date fetching the timezone information each time. So
    Knut> I'm a bit worried that adding getenv() here could reduce
    Knut> performance. I don't have the time to write a benchmark test
    Knut> right now, but I just wanted to mention it.

Ok, this might indeed be a problem, but if we call getenv() only if
neither $_SERVER nor $_ENV contains whatever we're looking for,
performance should no degrade.