In the PHP code when put $result
variable more than 100. Then output should be "Your result is invalid". But it's showing "You have passed". Why?
Can anybody help me please?
Check code here - https://pasteboard.co/HZkC73C.png
In the PHP code when put $result
variable more than 100. Then output should be "Your result is invalid". But it's showing "You have passed". Why?
Can anybody help me please?
Check code here - https://pasteboard.co/HZkC73C.png
Cause your variable has value greater than 33 and greater than 100 in the same time, and it goes only into first IF statement block. If you need second statement to be valid - switch IF and ELSE IF blocks.
<?php
$result=130;
if($result >=30 && $result <=100){
echo "You have passed";
}
elseif ($result < 0 || $result >100) {
echo "Your result is invalid";
}
else {
echo "fail";
}
?>