";}$function_holder = "sayHello";$function_holder();?>"/>
Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    function sayHello()

    {

    echo "HelloWorld<br />";

    }

    $function_holder = "sayHello";

    $function_holder();

    ?>

  2. A.

     No Output

    B.

     Error

    C.

     sayHello

    D.

     HelloWorld

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    It is possible to assign function names as strings to variables and then treat these variables exactly as you would the function name itself.


Be The First To Comment