PHP MCQ PHP Basic MCQ Question #2356
MCQ Single Best Answer Not Set

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

ID: #2356 PHP Basic MCQ 1,826 views
Question Info
#2356Q ID
Not SetDifficulty
PHP Basic MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Error
  • B My name is BobBob
  • C My name is BobMy name is Bob
  • D My name is Bob Bob
Correct Answer: Option C

Explanation

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

Share This Question

Challenge a friend or share with your study group.