RE: [PHP] Re: if/elseif/else v. switch
| From: | Dennis Seavers | Date: | Sat, 05 Jun 2004 22:34:20 +0000 |
| Subject: | RE: [PHP] Re: if/elseif/else v. switch | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187712@lists.php.net to get a copy of this message | ||
Good. Initially, before I sent this message, I was concerned that it was a
really, really, really stupid question. But I apparently hit the mark
perfectly with two "really"s. Since you seem to enjoy answering them, I
shall try to come up with a slew of what I hope will be really, really
stupid questions, just for you. Should I send them to your e-mail
directly, or share them with the whole list? After all, maybe not everyone
enjoys really, really stupid questions as much as you.
Just a quick note to clarify: I did ask about the difference between the
two conditionals, and a difference in speed is a good example of a
difference.
In seriousness, if you think it's an unworthy question, why take the time
to respond? Deleting the message will take far less energy. Also, I can't
see the harm in asking a stupid question (or question that involves one or
more "really"s), so long as I get an answer. After all, it isn't as though
I ask people to write scripts for me or ask questions just to avoid the
hassle of looking in the manual.
> [Original Message]
> From: Aidan Lister <aidan@php.net>
> To: <php-general@lists.php.net>
> Date: 06/05/2004 2:04:03 AM
> Subject: [PHP] Re: if/elseif/else v. switch
>
> This appears to be a really, really stupid question.
>
> If they are indentical in operation, then ofcourse there will be no
> noticeable difference to the user.
>
>
> One may note that a switch statement is faster, because the condition is
> only evaluated once. However you did not ask about the speed difference.
>
>
> "Dennis Seavers" <deseavers@mindspring.com> wrote in message
> news:410-220046655396940@mindspring.com...
> > Is there any noticeable difference (on the part of the client) between
> identical conditionals, one written as a switch, the other written as an
if,
> elseif ... else conditional? I realize that one programmer coming in
behind
> another might prefer the gentler layout of a switch; but would there be
any
> perceivable difference, client-side, between the options?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php