Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

if... else... & elseif

$
0
0

Hi, since learning PHP i've come across this and i'm a little confused. Was wondering if anyone could shed some light on it.

 

I'm more than familiar with IF statements from C++. However i'm confused as to why you might use an ELSEIF...

 

why does it not work like this (below)?

IF(This is true)
{
do this
}

IF(this is true)
{
do this
}

IF(this is true)
{
do this
}

else
{
go home, you're drunk
}

I don't under stand why if you make the first IF statement every other IF statement has to be an ELSEIF.

 

Many thanks,

Royal1664


Viewing all articles
Browse latest Browse all 13200

Trending Articles