SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    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

  2. #2
    SitePoint Wizard
    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') )

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool thats what i needed thanks!

    Garrett


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •