"> What will be the output of the following PHP code ?<?php$p

Home » PHP » PHP Operators » Question
  1. What will be the output of the following PHP code ?
    <?php
    $p = 5;
    $q = 6;
    if (++$p == $q++)
    {
    echo "true ", $q, $p;
    }
    ?>
    1. true
    2. 7
    3. 6
    4. true 67
    5. true 76
Correct Option: E

p is preincremented and q is post incremented thus both are 6 in the if condition, later q is increment.



Your comments will be displayed only after manual approval.