Quantcast
Channel: 9zap.com » PHP
Viewing all articles
Browse latest Browse all 15

PHP If Else statement

$
0
0

php
IF statement is an important conditional and logical statement in PHP. If, else construct is used to add logic in php code.

If else construct syntax:

If (conditions)
{
// Execute these codes if condition is true
}
else
{
// Execute these codes if condition is false
}

Example:

<?php
$a = 50;
if($a > 30)
   {
	echo "Congrats!! $a is greater than 30";
   }
else
   {
	echo "Sorry, $a is less than 30";
   }
?>

Viewing all articles
Browse latest Browse all 15

Trending Articles