Examveda

What will be the output of the following PHP code?
<?php
function sayHello()
{
   echo "HelloWorld<br />";
}
$function_holder = "sayHello";
$function_holder();
?>

A. No Output

B. Error

C. sayHello

D. HelloWorld

Answer: Option D

Solution (By Examveda Team)

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

This Question Belongs to PHP >> Functions

Join The Discussion

Related Questions on Functions