Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    function start($string)

    {

    if ($string < 45)

    return 20;

    else

    return 40;

    }

    $t = start(90);

    if ($t < 20)

    {

    echo "Have a good day!";

    }

    else

    {

    echo "Have a good night!";

    }

    ?>

  2. A.

     Have a good day!

    B.

     Have a good night!

    C.

     ERROR

    D.

     None of the mentioned

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    Function returns 40. this is greater than 20, hence the output.


Be The First To Comment