3

Possible Duplicate:
underlying difference between elseif vs else if

What is the difference between PHP conditions else if and elseif ...

<?php

....

else if($count == 4) {}

and

elseif($count == 4) {}

Is there any special case to use one or not? Thanks!!

Community
  • 1
  • 1
Madan Sapkota
  • 25,047
  • 11
  • 113
  • 117
  • possible duplicate of [Are “elseif” and “else if” completely synonymous?](http://stackoverflow.com/questions/3662412/are-elseif-and-else-if-completely-synonymous) – NullPoiиteя Jan 30 '13 at 16:49

2 Answers2

8

With curly braces, it makes no difference. When using a colon to define your conditions, 'else if' will fail due to parse error.

See here for more details.

PlantTheIdea
  • 16,061
  • 5
  • 35
  • 40
0

Logically they are exactly the same.

They may be interpreted differently by the parser which may result in very slight performance differences.

Mitch Satchwell
  • 4,770
  • 2
  • 24
  • 31