> Personally, as I said before, I use if/else for two conditions and
 switch for three or more. Your mileage may vary, but it's truly a
 > matter of choice and is not one of asinine methodology.

 > tedd


I think that's a fairly good methodology to follow.  I usually do that...
except when I run into a huge list of multiple conditions for each
possibility (TRUE && FALSE OR FALSE && TRUE) etc.  To me IF/ELSEIF is easier
to ready in that case,

The true && false scenarios require me to work up a truth table, for I have great difficulty figuring that out in my head.

and SWITCH is a LOT easier to read if you have one
variable and have a CASE for each possibility of that variable.

I believe (until someone informs me otherwise) that your statement above is a common misconception of the switch conditional -- you don't need a single variable to evaluate. Case in point, try this (taken from your own code).

$who_cares = 1;
switch ($who_cares)
    {
    case $numFFELP > 1 && count($FFELP_Lenders) > 1 && $numFFELP == $numTotal:
    $retVal = array(TRUE, 'A');
    break;

    case $numFFELP > 0 && $enumFFELP > 0 && count($FFELP_Lenders) > 1 &&
    $enumFFELP + $numFFELP == $numTotal:
    $retVal = array(TRUE, 'A');
    break;
    }

Note, it's not actually required to have a variable to be evaluated for each case statement. Each case statement stands on it's own independent from the evaluation.

This has always worked for me in other languages and I am assuming that it works the same in php.

Does anyone disagree or will correct me?

HTH's.

tedd

--
--------------------------------------------------------------------------------
http://sperling.com

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

Reply via email to