Complete the code to check if a number is positive.
<?php $number = 10; if ($number [1] 0) { echo "Positive number"; } ?>
The condition $number > 0 checks if the number is positive.
Complete the code to check if a number is zero.
<?php $number = 0; if ($number [1] 0) { echo "Number is zero"; } ?>
The condition $number == 0 checks if the number equals zero.
Fix the error in the nested if statement to check if a number is negative.
<?php $number = -5; if ($number < 0) { if ($number [1] -10) { echo "Number is between -10 and 0"; } } ?>
The inner condition $number > -10 checks if the number is greater than -10, so it is between -10 and 0.
Fill both blanks to complete the nested condition that checks if a number is positive and even.
<?php $number = 8; if ($number [1] 0) { if ($number % 2 [2] 0) { echo "Number is positive and even"; } } ?>
The first condition $number > 0 checks positivity. The second $number % 2 == 0 checks if the number is even.
Fill all three blanks to complete the nested condition that checks if a number is negative, odd, and less than -5.
<?php $number = -7; if ($number [1] 0) { if ($number % 2 [2] 0) { if ($number [3] -5) { echo "Number is negative, odd, and less than -5"; } } } ?>
The first condition $number < 0 checks negativity. The second $number % 2 != 0 checks oddness. The third $number < -5 checks if number is less than -5.