PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
jeeep
Forum Commoner
Posts: 57 Joined: Fri Apr 28, 2006 1:43 am
Post
by jeeep » Wed Nov 01, 2006 12:00 pm
Here is the basic code
Code: Select all
$number = 46;
if ($number >=45) {echo"greater than 45";}
else {
if ($number < 45) {echo"less than 45";}}
This works correctly buy what I would like to do is narrow it down though, to where it could detect if the number were between 45 and 50.
In theory this:
Code: Select all
$number = 46;
if ($number >=45, <= 50) {echo"between 45 and 50";}
else {
if ($number < 45) {echo"less than 45";}}
But this doesnt work. Anyone have any ideas?
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Wed Nov 01, 2006 12:14 pm
Code: Select all
if ($number >=45 && $number <= 50)
{
echo"between 45 and 50";
}
elseif ($number < 45)
{
echo "less than 45";
}
else
{
echo "more than 45";
}
i think
jeeep
Forum Commoner
Posts: 57 Joined: Fri Apr 28, 2006 1:43 am
Post
by jeeep » Wed Nov 01, 2006 12:18 pm
awesome, thanks!