RE: [PHP] if/elseif being treated as if/if

From: Date: Sat, 25 Sep 2010 15:01:45 +0000
Subject: RE: [PHP] if/elseif being treated as if/if
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-308312@lists.php.net to get a copy of this message
At 9:04 PM +0100 9/24/10, Ashley Sheridan wrote:
I don't often use this type of logic, but I have used it before and it's served me well. Essentially, a switch is a glorified if statement, and I find them a lot nicer to read and write than a series of if/elseif blocks. Thanks, Ash
Ash: Exactly my take. I wouldn't live next door to an ELSEIF even if it lived in a good neighborhood. :-) However, I always thought (maybe in error) that the switch control (CASE statement) was derived from the computed GOTO rather than from the three-way IF statement. One can make the argument that the ELSE IF statement first surfaced circa 1977 in FORTRAN 77 and the CASE statement came later in FORTRAN 90 circa 1991. But I know I was using computed GOTOs and GOSUBs long before then. In any event, to me the computed GOTO is more like the CASE statement than ELSE IF. Cheers, tedd -- ------- http://sperling.com/

« previous php.general (#308312) next »