What will be the output of the following code?
$foo = 'Bob';
$bar = &$foo;        
$bar = "My name is $bar";
echo $bar;
echo $foo;

A. Error

B. My name is BobBob

C. My name is BobMy name is Bob

D. My name is Bob Bob

Answer: Option C

Solution(By Examveda Team)

The $bar = &$foo; line will reference $foo via $bar.

Join The Discussion

Related Questions on Basic PHP