Are "elseif" and "else if" completely synonymous?

Viewed 68597

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.

3 Answers

Yes, "elseif" and "else if" both are synonymous, alike in meaning and significance. You can mix "else if" with "elseif" together.

For Example - We can use "else if" and "elseif" together.
if($condition){
  ...
}
else if($condition){
  ...
}
elseif($condition){
  ...
}

Nested:
if($condition){
  ...
}
else if($condition){
  if($condition){
    ...
  }
  elseif($condition){
    ...
  }
}
Related