Skip to content

Latest commit

 

History

History
30 lines (26 loc) · 613 Bytes

0359.md

File metadata and controls

30 lines (26 loc) · 613 Bytes

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