I have noticed if a value is null i can increment it by one using ++$value but its not true about decrement , meaning --$value would return null , why?
$value = null;
echo ++$value; // 1
echo --$value; // null (I'm expecting -1)
Ref# language.operators.increment.php
Note: The increment/decrement operators only affect numbers and strings. Arrays, objects and resources are not affected. Decrementing NULL values has no effect too, but incrementing them results in 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With