if else in PHP

Advertisements

Do While Loop in PHP Break Statement in PHP

if else in PHP

In php if else statement is used to test condition. If conditon is true execute the code other wise control goes outside.

PHP If Statement

PHP if statement is executed if condition is true.

Syntax

if(condition)
{  
//code to be executed  
}    

if Statement Example in PHP

<?php

$age=20;  
if($age<18)
{  
echo "$You are Adult";  
}  

?>

Output

You are Adult

PHP If-else Statement

PHP if-else statement is executed whether condition is true or false.

Syntax

if(condition)
{  
//code to be executed if true  
}
else
{  
//code to be executed if false  
}     

if else Example in PHP

<?php

$num=10;  
if($num%2==0)
{  
echo "$num is even number";  
}
else
{  
echo "$num is odd number";  
}  

?>

Output

10 is even number

Do While Loop in PHP Break Statement in PHP

Advertisements

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Download Projects

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements