Home Ask Login Register

Developers Planet

Your answer is one click away!

daninthemix February 2016

PHP if statement - either but not both

What's the correct way to rephrase this statement so that it passes if either variable is set, but not if BOTH are set?

if (isset($_GET['txnid']) || isset($_GET['complete'])){


Neat February 2016

Yes, its called an XOR, it will be true if either one of them is true, but not both.

if (isset($_GET['txnid']) XOR isset($_GET['complete'])){

Source: PHP: Logical Operators

Post Status

Asked in February 2016
Viewed 2,326 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life