I am new to PHP and I am struggling to see why my code is not working when the echo
displays 0
. The code works for everything else however whenever the random operator chooses 0
it outputs 0 Negative
, when I have it to display as Zero
. I have no idea why it is doing this and I would appreciate any guidance.
$randomNumber = rand(-5, 5);
$var = $randomNumber;
echo $randomNumber;
echo $integerValue = (($var === 0) ? " Zero" : ($var <=-1) ? " Negative" : (($var >=1) ? " Positive" : " Not Positive or Zero") );