PHP Introduction


  1. Who is the father of PHP?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Rasmus Lerdorf


  1. What will be the output of the following PHP code?
    <?php
    $math = "25 students";
    $Science = 35;
    $math = $math + $Science;
    echo "$math";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The integer value at the beginning of the original $math string is used in the calculation. However if it begins with anything but a numerical value, the value will be 0.



  1. Which of the below statements is equivalent to $sum+= $sum ?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    a += b is an addition assignment whose outcome is a = a + b. Same can be done with subtraction,multiplication,division etc.


  1. Which statement will output $x on the screen?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    A backslash is used so that the dollar sign is treated as a normal string character rather than prompt PHP to treat $x as a variable. The backslash used in this manner is known as escape character.



  1. What will be the output of the following code?
    <?php
    function track()
    {
    static $var = 0;
    $var++;
    echo $var;
    }
    track();
    track();
    track();
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Because $count is static, it retains its previous value each time the function is executed.