I have a problem in writing interval condition inside IF ELSE: This is my condition :
if(1<x<=30)
{ statement }
else
{ statement }
If you want to check interval/range then you can do it using following:
if($x > 1 && $x <= 30){
statement
}else{
statement
}
You can use like this:
if(1 < $x AND $x <= 30)
echo true;
else
echo false;
You can use like this::
if(1<x && x<=30)
{ statement }
else
{ statement }
In simple case, Ternary operator is best in practise.
$result = ($x > 1 && $x<=30) ? true : false;