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

Home » PHP » PHP If Else/Else If Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    $str = "s";
    if ($str)
    print "Executed....";
    else
    print "Not Executed...";
    ?>
    1. Nothing
    2. Error
    3. Not Executed...
    4. Executed....
    5. None of these
Correct Option: D

The value of str is evaluated to 1 as it has a value.



Your comments will be displayed only after manual approval.