PHP Syntax


  1. What will be the output of the following PHP code ?
    <?php
    $Team1 = "Chennai Super King";
    $Team2 = "Mumbai Indian";
    echo "$Team1 " . "$Team2";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    The . operator is used to join to strings.


  1. What will be the output of the following PHP code ?
    <?php
    $Country1 = "INDIA";
    $Country2 = "USA";
    echo "$Country1" + "$Country2";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    + operator does not join both the strings.



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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    + does not return 1 if the variables are equal.


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    + just returns the numeric value even though it is inside double quotes.



  1. What will be the output of the following PHP code ?
    <?php
    $Country1 = "1";
    $Country2 = "1";
    echo "$Country1" + "$Country2";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    + can be used to add to integer values which are enclosed by double-quotes.