if Statement Uses else

if Statement uses else

When working with the if statement, you will often want to define an alternative block

of code that should be executed if the expression you are testing evaluates to false. You

can do this by adding else to the if statement followed by a further block of code:

if ( expression ) {

// code to execute if the expression evaluates to true

} else {

// code to execute in all other cases

}

<?php
$status = 1;
if ( $status == 1 ) {
echo “I am active here”;
}
else {
echo “I inactive am here”;
}?>

//