Re: switch vs elseif

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 3:15 PM -0500 1/12/09, Frank Stanovcak wrote:
I've googled, and found some confusing answers.
I've tried searching the history of the news group, and only found info on
switch or elseif seperately.  :(

Strictly from a performance stand point, not preference or anything else, is
there a benefit of one over the other?


for($i=0;$i<3;$i++){
    switch($i){
        case 0:
            header pg1 code
        break;
        case 1:
            header pg2 code
        break;
        case 3:
            header pg3 code
        break;
    };
};


or would that be better served using an if...elseif structure?

Frank

elseif!!!

Arrgggg !!!

I guess that today is my day to get myself in all sorts of trouble.

I have never used elseif -- and can't stand it,

tedd's rules.

if ($options > 2)
  {
   echo('use switch');
   {
else
   {
   echo('use if');
   }

Reason? It makes sense to me.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux