Results 1 to 6 of 6

Thread: [RESOLVED] Check 2 boolean values in return

  1. #1

    Thread Starter
    Lively Member Y.P.Y's Avatar
    Join Date
    Sep 2008
    Location
    Tehran - Iran
    Posts
    88

    Resolved _______________________________

    _______________________________
    Last edited by Y.P.Y; Apr 28th, 2012 at 05:16 PM.

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Check 2 boolean values in return

    Maybe I don't really understand what you mean, but why don't you just multiply the values together?

    The only way the function will return true is if both are true.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Check 2 boolean values in return

    return $this->_Bln_QueryExcuted && $this->_Bln_RowsAffected

    The result of the && operation is always a boolean. Therefore you just need to return that.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4

    Thread Starter
    Lively Member Y.P.Y's Avatar
    Join Date
    Sep 2008
    Location
    Tehran - Iran
    Posts
    88

    Re: Check 2 boolean values in return

    Thanks VisualAd.
    Also what is difference between:

    return($_X ? $_Y= fale : $_Y= true) V.S. return($_X) ? $_Y= fale : $_Y= true;

    Regards.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Check 2 boolean values in return

    The first is syntactically valid but looks incorrect (or at best, misleading). The second is invalid.

    The ternary conditional operator takes a boolean condition and two values. If the condition evaluates to true, the first value is returned; if not, the second.

    The first snippet will evaluate $_X, then assign either false (if $_X is true) or true (if $_X is false) to $_Y, and return that.

  6. #6

    Thread Starter
    Lively Member Y.P.Y's Avatar
    Join Date
    Sep 2008
    Location
    Tehran - Iran
    Posts
    88

    Re: Check 2 boolean values in return

    Thanks Penagate. Resolved .

Posting Permissions

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



Click Here to Expand Forum to Full Width