PHP Introduction


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    .= is a concatenation-assignment. $str equals its current value concatenated with “get”.


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











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    === operator returns 1 if $num and $num1 are equivalent and $num and $num1 have the same type.



  1. Which of the below symbols is a newline character?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    PHP treats \n as newline character.


  1. What will be the output of the following PHP code?
    $n = 18;
    echo 'What is her age? \n She is $n years old.';
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    When a string is enclosed within single quotes both variables and escape sequences will not be interpreted when the string is parsed.



  1. Which of the conditional statements is/are supported by PHP?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    switch statements, if-elseif statements, if statements and if-else statements of the conditional statements are supported by PHP.