If statement enable you to execute a script only if a condition is true.
Simple if statement:
php code:
<?php
$age = 28;
if ($age == 28)
echo "hello ! Your age is 28";
?>
$age = 28;
if ($age == 28)
echo "hello ! Your age is 28";
?>
hello ! Your age is 28
But if you want to do many lines of code under the if statement, you should do:
php code:
<?php
$age = 28;
if ($age == 28)
{
echo "hello ! Your age is 28";
echo "
" ;
echo "You are wellcome !";
?>
$age = 28;
if ($age == 28)
{
echo "hello ! Your age is 28";
echo "
" ;
echo "You are wellcome !";
?>
hello ! Your age is 28
You are wellcome !
You are wellcome !