"/>
Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    $op2 = "blabla";

    function foo($op1)

    {

    echo $op1;

    echo $op2;

    }

    foo("hello");

    ?>

  2. A.

     helloblabla

    B.

     Error

    C.

     hello

    D.

     helloblablablabla

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    If u want to put some variables in function that was not passed by it, you must use “global”. Inside the function type global $op2.


Be The First To Comment