SAMPLE 1
<?php
$studentId = 'A1110601'; if ( $studentId == 'A1110601' ) { echo ' Student ID: '.$studentId.'<br/>'. ' Welcome! Inah Ysabela Marie D. Alegre'; }
?>
SAMPLE 2
<?php
$birthdate = 'April 8, 1995'; if ( $birthdate == 'April 8, 1995' ) { echo ' Birthdate : '.$birthdate; }
?>
SAMPLE 3
<?php
$grade = 86; if ( $grade == 86 ) { echo ' Passed! Your grade is '.$grade; }
?>
SAMPLE 4
<?php
$employee = 'Mary Jane Santos'; if ( $employee == 'Mary Jane Santos' ) { echo $employee.' you are hired! '; }
?>
SAMPLE 5
<?php
$university = 'University of Makati' ;
if ( $university == 'University of Makati' ) { echo 'I am studying at '.$university; }
?>
IF … ELSE STATEMENT
SAMPLE 1
<?php
$gender = 'Female'; if ($gender == 'Female')
{
echo ' Beautiful lady';
}
else
{
echo ' Handsome man';
}
?>
SAMPLE 2
<?php
$grade = 65; if ($grade >= 80)
{
echo 'Congratulations, you passed!';
}
else
{
echo ' Sorry, you failed!';
}
?>
SAMPLE 3
<?php
$items = 125; if ($items >= 100)
{
echo ' Over stock!';
}
else
{
echo ' Out-of-stock!';
}
?>
SAMPLE 4
<?php
$num = 19; if ($num % 2 == 0)
{
echo ' Number is Even!';
}
else
{
echo ' Number is Odd!';
}
?>
SAMPLE 5
<?php
$age = 36 ; if ($age >= 30)
{
echo ' You are an adult.';
}
else
{
echo ' You are a teenager.';
}
?>
IF … ELSE IF … ELSE STATEMENT
SAMPLE 1
<?php
$mysteryGift = ‘choice2’; if ( $mysteryGift == ‘choice1’ ) { echo ‘A brown teddy bear.’; } elseif ( $mysteryGift == ‘choice2’ ) { echo ‘A pink rabbit.’; } else { echo ‘A white panda.’; } ?>
SAMPLE 2
<?php
$order = ‘2 choco honey dip’; if ( $order == ‘2 choco honey dip’ ) { echo ‘Your bill is 40.00 ‘; } elseif (