PHP Echo/Print


  1. What will be the output of the following PHP code ?
    <?php
    print("This"."is"."a"."good"."girl");
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    You can use the dot operator like in echo but you can not use the comma operator to do the same.


  1. What will be the output of the following PHP code ?
    <?php
    print "echo Interview Mania";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The print statement will print whatever is present inside the double-quotes.



  1. What will be the output of the following PHP code ?
    <?php
    $num = 5;
    print($num);
    print $num;
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    Print can be used with or without parentheses.


  1. What will be the output of the following PHP code ?
    <?php
    $City = array("Chennai", "Mumbai", "Noida");
    print $City[2];
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Print statement can be used to output a specific array member.



  1. What will be the output of the following PHP code ?
    <?php
    $First = "Ajit";
    $Second = "Ats";
    print($First $Second);
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    The above syntax will produce an error, unlike the echo statement.