Re: logic operands problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Devendra Jadhav wrote:
what do you think about this?
if( ! (page == 1 && page == 2)){
      //here
}


Well a simple && (and) does not help.

I want to have all results that contain either page = 1 OR page = 3, AND in the same time I want to have the results that contain page=2 OR page= 3 , But the result should never contain page = 1 and page = 2 in the same time.

Any further idea?





On Mon, Dec 7, 2009 at 4:22 PM, Merlin Morgenstern <merlin_x@xxxxxxxxxxx <mailto:merlin_x@xxxxxxxxxxx>> wrote:

    Hello everybody,

    I am having trouble finding a logic for following problem:

    Should be true if:
    page = 1 OR page = 3, but it should also be true if page = 2 OR
    page = 3

    The result should never contain 1 AND 2 in the same time.

    This obviously does not work:
    (page = 1 OR page = 3) OR (page = 2 OR page = 3)

    This also does not work:
    (page = 1 OR page = 3 AND page != 2) OR (page = 2 OR page = 3 AND
    page != 1)

    Has somebody an idea how to solve this?

    Thank you in advance for any help!

    Merlin

-- PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php




--
Devendra Jadhav
देवेंद्र जाधव

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux