What will be the output of the following PHP code?
<?php
$a = 1;
$b = 2;
$c = 3;
echo ($a * (($b) – $c));
?>
a) 1
b) -1
c) 2
d) -2
Answer: b
Explanation: The innermost bracket is evaluated first since it covers only variable B, it is as good as not using brackets, then $b- $c action will be performed.
Related Posts
How many value/values does Boolean data type hold?
When you use the $_POST variable to collect data, the data is visible to
Which type of string can processes special characters inside quotes?
Which one of the following should not be used while sending passwords or other sensitive information?
The ________ function compares the two strings s1 and s2, ignoring the case of the characters.
Which one of the following is the right way to define a constant?
Which is true about var_dump() function?
Join The Discussion