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

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

The function strlen($s) gives the length of the string,5, which is considered true.



Your comments will be displayed only after manual approval.