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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    113
    Thanks
    27
    Thanked 0 Times in 0 Posts

    if...else statements with multiple conditions

    I want a function to intiate only if 2 different conditions are met. Would the syntax for this be....

    if (condition1) && (condition2)
    function ()


    ?

    Thanks.

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    yes..
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Maybe it's No, and is suppose to be like this instead:
    Code:
    if(condition1&&condition2)
    myfunc();
    or
    Code:
    if((condition1) && (condition2))
    myfunc();
    If nothing happens, up the code so we could play with it.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • Users who have thanked rangana for this post:

    mightypants (06-17-2008)

  • #4
    Regular Coder
    Join Date
    Jun 2008
    Posts
    113
    Thanks
    27
    Thanked 0 Times in 0 Posts
    rangana,

    Both of the ones you suggested worked, mine did not. Thanks.


  •  

    Posting Permissions

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