Html4newbies
Put your hands into html and php
Home
Privacy
About
Contact

Hosting Links
Hosting
Free Php Snippets
Php Snippets 1
Php Snippets 2
Php if statement


Using if and else and elseif statments
<?php
$rain="No";
if ($rain=="Yes") {
echo 'It is raining';
}elseif($rain=="Not sure") {
echo 'Is it raining';
}else{
echo 'It is not raining';	
}
?>



Result:
It is not raining

Here we used the variable $rain with a value of No
We also used Comparison Operators ==
OperatorEnglish Example Result
== Equal To $x == $y false
!= Not Equal To $x != $y true
< Less Than $x < $y true
> Greater Than $x > $y false
<= Less Than or Equal To $x <= $y true
>= Greater Than or Equal To $x >= $y false


Copyright © 2002-2017 Html4newbies - Html4newbies.com NetWork