RE: if/elseif being treated as if/if

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

 



[snip]
I am not in the majority when I say for conditions where you have 
more than two options use a switch control and not an elseif.

In 40+ years of programming, I have never used elseif because the 
control confuses me. It is *much* easier for me to use, understand, 
and document a switch statement than an elseif.
[/snip]

I second this, but first I must ask; have you echo'd out the values of
each item to confirm what you are evaluating?

Don't get me wrong, using elseif is a fine control structure if it sees
limited use, like this;

if('foo' == $a){
   // do foo
} elseif('bar' == $a){
   // do bar
} else {
   // do glorp
}

If it goes beyond that I use a switch control and it has served me well
for years.

My bet is if you echo out the values of the items you're evaluating you
will see something that will point you to the cause of your issues.

-- 
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