<<< Previous question <<< Question ID#0359.md >>> Next question >>>
This question tests your knowledge of boolean values and casting. What is the output of the following PHP script.
$myInt = -1;
$myBool = (bool) $myInt;
if ($myBool > 0) {
echo "5";
} else if ($myBool == true) {
echo "6";
} else if (!$myBool) {
echo "7";
} else {
echo sprintf("%d", $myBool);
}
Enter the exact script output
- A) 5
- B) 7
- C) 6
- D) -1
Answer
Answer: A