Home » PHP » PHP Introduction » Question
  1. What will be the output of the following code?
    <?php 
    $name = 'Ajit';
    $temp = &$name;
    $temp = "My name is $temp. ";
    echo $temp;
    echo $name;
    ?>
    1. AjitAjit
    2. My name is Ajit. My name is Ajit.
    3. Ajit
    4. Error
    5. None of these
Correct Option: B

The $temp = &$name; line will reference $name via $temp.



Your comments will be displayed only after manual approval.