Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1063185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:44:46+00:00 2026-05-16T18:44:46+00:00

Are elseif and else if completely synonymous, or is there a difference? Does Zend

  • 0

Are elseif and else if completely synonymous, or is there a difference?

Does Zend have an accepted “standard” on which one to use?

While I personally dislike seeing elseif in the code, I just need to know if they’re synonymous and the PHP manual isn’t the easiest to search.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:44:47+00:00Added an answer on May 16, 2026 at 6:44 pm

    From the PHP manual:

    In PHP, you can also write ‘else if’ (in two words) and the behavior would be identical to the one of ‘elseif’ (in a single word). The syntactic meaning is slightly different (if you’re familiar with C, this is the same behavior) but the bottom line is that both would result in exactly the same behavior.

    Essentially, they will behave the same, but else if is technically equivalent to a nested structure like so:

    if (first_condition)
    {
    
    }
    else
    {
      if (second_condition)
      {
    
      }
    }
    

    The manual also notes:

    Note that elseif and else if will only be considered exactly the same when using curly brackets as in the above example. When using a colon to define your if/elseif conditions, you must not separate else if into two words, or PHP will fail with a parse error.

    Which means that in the normal control structure form (ie. using braces):

    if (first_condition)
    {
    
    }
    elseif (second_condition)
    {
    
    }
    

    either elseif or else if can be used. However, if you use the alternate syntax, you must use elseif:

    if (first_condition):
      // ...
    elseif (second_condition):
      // ...
    endif;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the situation: We have some generic graphics code that we use for one
I am completely stumped on this one. I have to utilize the current code
I have the following short version of a tsql if else if.. IF @var
Suppose I have two boolean variables, and I want to do completely different things
I am completely stumped on what appears to be a trivial problem. I have
I basically have exp>=level*10 in an else if expression, where level is a variable
Is it generally better/faster to do: if (condition) return a else if (condition2) return
Getting message expected identifier in red for below these two statements } else if
Here is the normal code : if(a==b) printf(equal); else if(a>b) printf(bigger); else printf(smaller); My
function menuhover(id,state){ if(id==home){ if(state==over){ document.getElementById(id).src=pages/styles/images/home1hover.png; } else if(state==out){ document.getElementById(id).src=pages/styles/images/home1.png; } } else if(id==news){ if(state==over){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.