Examveda
Examveda

What will be the output of the following PHP code?
<?php
function foo($msg)
{
    echo "$msg";
}
$var1 = "foo";
$var1("will this work");
?>

A. Error

B. $msg

C. 0

D. Will this work

Answer: Option D

Solution(By Examveda Team)

It is possible to call a function using a variable which stores the function name.

This Question Belongs to PHP >> Functions

Join The Discussion

Related Questions on Functions