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
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Sat Aug 17, 2002 6:54 am
Any ideas?
I just need to know how to do the "if ($something is between 1 and 10)" part.
===============
Code: Select all
$something = 3;
if ($something is between 1 and 10) {
DO THIS
}
else {
DO THIS
}
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sat Aug 17, 2002 7:02 am
Code: Select all
if ($something >= 1 || $something <= 10) {
// do this
}
else {
// do this
}
llimllib
Moderator
Posts: 466 Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD
Post
by llimllib » Sat Aug 17, 2002 8:01 am
Code: Select all
if ($something >= 1 && $something <= 10) {
// do this
}
else {
// do this
}
To be technical, you want the && (and) not the || (or) symbol between those.
DynamiteHost
Forum Commoner
Posts: 69 Joined: Sat Aug 10, 2002 5:33 pm
Post
by DynamiteHost » Sat Aug 17, 2002 8:32 am
Thanks for the help you two, its appreciated
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Sat Aug 17, 2002 4:09 pm
very much so!
hob_goblin
Forum Regular
Posts: 978 Joined: Sun Apr 28, 2002 9:53 pm
Contact:
Post
by hob_goblin » Sat Aug 17, 2002 4:46 pm
ahh my brain wasnt working that late, i had the right idea though