Hey all,
i need some help AGAIN.
I need a code that if $var1 = 1 the outcome = A
but if $var1 = any number from 2 to 10 , the outcome = B
and if $var = more then 10, the outcome = C
is this possible? It's mainly the second bit i have problems with , i dont know how to put 'a number from 2 to 10' in my 'if'-session.
Thanks for the help
if-code
Moderator: General Moderators
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
- ambivalent
- Forum Contributor
- Posts: 173
- Joined: Thu Apr 14, 2005 8:58 pm
- Location: Toronto, ON
Re: if-code
ben_albrechts wrote:
is this possible? It's mainly the second bit i have problems with , i dont know how to put 'a number from 2 to 10' in my 'if'-session.
Code: Select all
if (($var1 >= 2) && ($var1 <=10)) {
//kinda like that?- trukfixer
- Forum Contributor
- Posts: 174
- Joined: Fri May 21, 2004 3:14 pm
- Location: Miami, Florida, USA
Re: if-code
http://us2.php.net/manual/en/language.c ... ctures.php <--- THE MANUALben_albrechts wrote:Hey all,
i need some help AGAIN.
I need a code that if $var1 = 1 the outcome = A
but if $var1 = any number from 2 to 10 , the outcome = B
and if $var = more then 10, the outcome = C
is this possible? It's mainly the second bit i have problems with , i dont know how to put 'a number from 2 to 10' in my 'if'-session.
Thanks for the help
Code: Select all
if($var1 == 1)
{
$outcome = "A";
}
elseif($var1 >1 && $var1 < 11)
{
$outcome = "B";
}
else
{
$outcome = "C";
}-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact: