Home » PHP » PHP Functions » Question
  1. What will be the output of the following PHP code ?
    <?php
    $num = 120;
    function calc()
    {
    echo $num;
    }
    calc();
    ?>
    1. Nothing
    2. 120
    3. Error
    4. 20
    5. None of these
Correct Option: A

$num is not global and hence is not available for calc().



Your comments will be displayed only after manual approval.