PHP Echo/Print


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

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


  1. What will be the output of the following PHP code ?
    <?php
    $Color1 = "RED";
    $Color2 = "YELLOW";
    print("$Color1$Color2");
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    This is same as the echo statement.



  1. What will be the output of the following PHP code ?
    <?php
    $Color1 = "YELLOW";
    $Color2 = "GREEN";
    print($Color1==$Color2);
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    Since we are equating two unequal strings we do not get any output.


  1. What will be the output of the following PHP code ?
    <?php
    $Country1 = "INDIA";
    $Country2 = "INDIA";
    print($Country1 == $Country2);
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    Since both the strings are equal the result 1 is printed on the screen.



  1. What will be the output of the following PHP code ?
    <?php
    print "Hello Interview Mania!<br>";
    print "I'm about to learn PHP!";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    Most of the properties of echo and print are same. Strings can contain HTML markup.