SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: control structures in php
-
Jun 2, 2001, 11:46 #1
- Join Date
- Jun 2000
- Posts
- 47
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
control structures in php
hello
can anyone tell me how i go about testing multiple conditions, for example ...
if $1 = $2
{
do something
}
else
{
do something else
}
where the if is how do i test for more than one possibility, simple as
if $1 = $2 and $2 = $3
is 'and' the correct syntax to use because i can find loads of documentation of control structures but never any examples with more than one test condition.
thanks in advance
Garrett
-
Jun 2, 2001, 11:49 #2
- Join Date
- Jul 1999
- Location
- Chicago
- Posts
- 2,629
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Actually, you should use && instead of "and".
Like this:
if( ($var1 == 'hh') && ($lala == 'asdf') )
-
Jun 2, 2001, 14:01 #3
- Join Date
- Jun 2000
- Posts
- 47
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
cool thats what i needed thanks!
Garrett
Bookmarks