Home / Programming MCQs / PHP MCQs / Question

P

Parvesh Kanani • 2.84K Points
Extraordinary

Q. What will be the output of the following PHP code ?

Code:
<?php
$t = 5;
if ($t-- == ++$t)
{
    echo $t;
}
?>
(A) Error
(B) 0
(C) Nothing
(D) 5
Explanation by: Parvesh Kanani
First $t = 5 is compared to and then decremented, then incremented and compared to $t = 5.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.