Php Conditions Statements

Posted on Updated on

ifelsePhp Conditions Statements

Condition statements are use to control the flow of program. in real life we works on conditions like if I am student then I have to study makes projects etc. if exams are coming I have to study hard else I am fail. In programming language its works with condition statements like if , if_else etc.

IF condition:

If condition is works when the condition is true. In real life I can vote if my age is greater than 18 or equal to 18.

Syntax :

If(condition)

{

Statement execute;

}

IF_ELSE:

If_else is works for two conditions true and false. If condition is works only when the condition is true and else is execute when the condition is false. In real life if I got 33  or above 33 marks I will pass otherwise I will fail.

Syntax:

If(condition)

{

Statement true execute;

}

Else

{

Statements false execute;

}

If else_if:

If else_if is use for multiple conditions checks.

Syntax:

If(condition)

{

Statemnt1;

}

Elseif

{

Statemnt2;

}

Elseif

{

Statemnt3;

}

Else

{

Statemnt4;

}

Switch:

Else if is replaced by the switch case. In this we pass the value to the switch and according to value the case is execute.

Syntax:

switch(variable)

{

case value:

{

statement;

break;

}

case value:

{

statement;

break;

}

case value:

{

statement;

break;

}

default:

{

statement;

break;

}

}

In switch case if the value is not found from the cases  the default case will run.

For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.

Helpline: 9814666333, 8699444666

Email:info@technocampus.co.in

**************************************************************************************************************

Please fill the FORM and we shall contact you soon.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s