This is really bothering me. I’m having trouble with some very very simple logic. A variable has to be between 5 and 35. If it is I want to print pass, if not print fail. I can’t, for the life of me, get this to work. Its so simple…
if($turboPressure > 5 && $turboPressure < 35)
{print "pass";}
else
{print "fail";}
Thats my latest attempt… I’ve tried like 4 different conditions and none have worked… Please help.
If anyone would like to look at it, I think you can view it at…
http://www.deltacst.net/php06/Lab4/Lab4.html
Your code works fine. Here’s proof:
This loops through 0 to 40, printing either pass or fail with the same condition you wrote.
You might want to do:
This makes sure that you’re dealing with integers instead of strings. If you’re using strings, your comparison will fail.
The only tricky part of my sample is the ternary operator, which takes this:
And transforms it into
Watch it work.
Edit:
Based on your sample code, you should get
$turboPressurelike so: