Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Php If Or Statement

    if statement...

    how do i say... if $a = "a" OR $b = "b"

    in php??

    Thanks, Justin

  • #2
    New Coder
    Join Date
    Apr 2006
    Location
    Planet Earth
    Posts
    59
    Thanks
    1
    Thanked 8 Times in 8 Posts
    PHP Code:
    if ($a == "a" or $b == "b"

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    You can also use the 'pipelines'.

    PHP Code:
    if ($a == "a" || $b == "b"

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok guys, thanks heaps...but it turns out that didn't work... i had to use Xor ....

  • #5
    New to the CF scene
    Join Date
    Sep 2009
    Location
    Slovenia
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    I know it's an old thread but this thread comes up in a Google search and just incase someone has problems with this, this way works:

    PHP Code:
    if (($a=="a") || ($b=="b")){
    //blah blah...


  • #6
    New Coder
    Join Date
    Jan 2010
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Craig82 View Post
    I know it's an old thread but this thread comes up in a Google search and just incase someone has problems with this, this way works:

    PHP Code:
    if (($a=="a") || ($b=="b")){
    //blah blah...

    Thanks, did indeed some up with a google search!


  •  

    Posting Permissions

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