Jump to content

Recommended Posts

yes, because elseif implies that the if was FALSE. else implies that the if (or elseif) was FALSE.

if (if this is true) {
do this
} elseif (since the above was not true, check if this is true. if it is true) {
do this
} else {
since the above was not true, do this
}

the difference between elseif and else is that else will be executed no matter what, if the if is false, whereas the elseif will only be executed if the if is false and the elseif is true. but elseif and/or else will not be executed if the if is true.
Link to comment
https://forums.phpfreaks.com/topic/11508-elseif/#findComment-43340
Share on other sites

[!--quoteo(post=381549:date=Jun 8 2006, 08:09 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Jun 8 2006, 08:09 PM) [snapback]381549[/snapback][/div][div class=\'quotemain\'][!--quotec--]
the difference between elseif and else is that else will be executed no matter what, if the if is false, whereas the elseif will only be executed if the if is false and the elseif is true. but elseif and/or else will not be executed if the if is true.
[/quote]

I think I preferred Poirot's answer :-)
Link to comment
https://forums.phpfreaks.com/topic/11508-elseif/#findComment-43365
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.