I tried this in a sandbox and -5 isn't empty <?php function isItEmpty($num){ echo (empty($num)? 'yes': 'no')."\n"; } $tot = 100; echo isItEmpty(10); echo isItEmpty(0); echo isItEmpty(-5); echo isItEmpty('10'); echo isItEmpty('0'); echo isItEmpty('-5'); echo isItEmpty(''); Code (markup): results no yes no no yes no yes Code (markup):
In the context of PHP, a negative variable like $payment = -5 is not considered empty, it's still holding a value. The condition `if($payment)` will be evaluated as true because non-zero numbers are treated as true. So, it would execute the code inside the block.
When I do a refund, one payment app I'm using, sends it through the same ipn. I'm trying to figure out how I'd tell the script in the ipn file to ignore the refunds (in my instance, negative payments).