PHP Introduction


  1. What will be the output of the following php code?
    <?php
    $n = "12";
    $n1 = "21";
    print $n+$n1;
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The numbers inside the double quotes are considered as integers and not string, therefore the value 33 is printed and not 12+21.


  1. What will be the output of the following php code?
    <?php
    $n = 10;
    $n1 = 12;
    print $n . "+". $n1;
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    .(dot) is used to combine two parts of the statement. Example ( $n. “Hello World” ) will output 10Hello World.



  1. Which of the following php statement/statements will store 120 in variable n?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    You need not specify the datatype in php.


  1. PHP files have a default file extension of_______











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    .php



  1. A PHP script should start with ___ and end with ___











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Every section of PHP code starts and ends by turning on and off PHP tags to let the server know that it needs to execute the PHP in between them.