--- Wouter van Vliet <[EMAIL PROTECTED]> wrote:
> One time I had this script somebody else wrote. About 1000 lines, a
> complete CMS in one file. It if'ed on simple $_GET vars about 10 times,
> by opening a new if statement each and every time. After I changed this
> to if ($_GET['p'] == 'one') { .. } elseif ($_GET['p'] == 'two') { .. };
> and so on the script became TWO SECONDS faster.

Another minor performance tip to add to this is to use $p in your
conditional statements rather than $_GET['p']. Of course, you should
filter this data also, but try something like this:

if ($_GET['p'] is valid data)
{
     $p = $_GET['p'];
}

When you use $p in the rest of the script, you save PHP the small
discovery time required for $_GET['p']. If you have many conditional
statements, this minor improvement can be amplified slightly, and if you
have many users (a few million a day, for example), this improvement is
further amplified.

Hope that helps.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to