Quote:
Originally Posted by Gunderak
Whats the difference between if and elseif o.o
They do the exact same thing..
|
It makes it clear the previous condition was not true, e.g.
PHP Code:
if (a > 5) {
// a is greater than 5
} else if (a < 5) {
// a is less than 5
} else {
// a must b 5
}
You should use them when appropriate as they make code easier to read.