Rob83
04-03-2005, 11:02 AM
Hey Guys,
Was wondering if someone can help me. I'm not *that good* in Php, but I can some basic stuff and I'm pretty sure I know the answer, but maybe I'm doing something wrong. Ironically, I'm taking a C++ course at the moment and it C++ is so similiar to php (or vise versa), so I may be getting confused on my commands.
Let's assign variables:
Let's say:
I have an array ("A", "B", "C", "D")
The array is assigned to $letter. And my script will do some work and assign $letter to one of the arrays (either A, B, C, D). Now $letter can BE all of them. It can be A & B, or A &C or A &D or A,B,C,D.
I have php script that has (not completely written on in php)
if $letter == "A"
echo "letter A!";
else if $letter == "B"
echo "letter B!";
and so on!
Now.. here is my question.
Is there a way that if $Letter equals more than 2, that I can have it's own if?
Like:
if $letter == "A" | $letter == "B";
echo "Letter A and B!"
But I have so many arrays, that I can't sit there and define both "A" and "B". So I would like to be something like this:
So would I use if $letter > 2
echo "$letter"
if $letter > 3
echo "$letter"
Is that right??
Was wondering if someone can help me. I'm not *that good* in Php, but I can some basic stuff and I'm pretty sure I know the answer, but maybe I'm doing something wrong. Ironically, I'm taking a C++ course at the moment and it C++ is so similiar to php (or vise versa), so I may be getting confused on my commands.
Let's assign variables:
Let's say:
I have an array ("A", "B", "C", "D")
The array is assigned to $letter. And my script will do some work and assign $letter to one of the arrays (either A, B, C, D). Now $letter can BE all of them. It can be A & B, or A &C or A &D or A,B,C,D.
I have php script that has (not completely written on in php)
if $letter == "A"
echo "letter A!";
else if $letter == "B"
echo "letter B!";
and so on!
Now.. here is my question.
Is there a way that if $Letter equals more than 2, that I can have it's own if?
Like:
if $letter == "A" | $letter == "B";
echo "Letter A and B!"
But I have so many arrays, that I can't sit there and define both "A" and "B". So I would like to be something like this:
So would I use if $letter > 2
echo "$letter"
if $letter > 3
echo "$letter"
Is that right??
