"> What will be the output of the following PHP code ?<?php$name

Home » PHP » PHP Echo/Print » Question
  1. What will be the output of the following PHP code ?
    <?php
    $name = array("Ajit", "Ats", "Aju");
    echo "My name is {$name[0]}";
    ?>
    1. Ajit
    2. My name is
    3. Error
    4. My name is Ajit
    5. None of these
Correct Option: D

In the echo statement the {$name[0]} is replaced by the 1st element in name that is Ajit.



Your comments will be displayed only after manual approval.