Home / CSE / PHP - CS :: Functions in PHP

CSE :: PHP - CS

  1. What will be the output of the following PHP code ?

    <?php

    function email()

    {

    $email = ’contact@examveda.com’;

    $new = strstr($email, ‘@');

    echo $new;

    }

    email();

    ?>

  2. A.

     contact

    B.

     contact@examveda.com

    C.

     @examveda.com

    D.

     examveda.com


  3. What will be the output of the following PHP code ?

    <?php

    function string()

    {

    echo strstr("Hello world!", 111);

    }

    string();

    ?>

  4. A.

     o world!

    B.

     Hello world!

    C.

     111

    D.

     No Output


  5.  . . . . . converts the keys of an array into values and the values into keys.

  6. A.

     array_flips()

    B.

     array_transpose()

    C.

     array_trans()

    D.

     array_flip()


  7. Above usleep() function pauses PHP for .

    usleep(1000000);

  8. A.

     1 second

    B.

     1 microseconds

    C.

     10 seconds

    D.

     100 microseconds


  9. Output will be:

    $array = array(0, 1, 2);

    $array = array_pad($array, -6, ‘NEW’);

  10. A.

     Array ( [1] => NEW [2] => NEW [3] => NEW [4] => 0 [5] => 1 [6] => 2 )

    B.

     Array ( [-1] => NEW [-2] => NEW [-3] => NEW [-4] => 0 [-5] => 1 [-6] => 2 )

    C.

     Array ( [0] => NEW [-1] => NEW [-2] => NEW [-3] => 0 [-4] => 1 [-5] => 2 )

    D.

     Array ( [0] => NEW [1] => NEW [2] => NEW [3] => 0 [4] => 1 [5] => 2 )


  11. phpinfo() will display about?
    1. OS version information
    2. PHP installation
    3. Variables
    4. HTTP headers

  12. A.

     Option 1

    B.

     Option 2

    C.

     Option 3

    D.

     Option 4

    E.

     All the Above


  13.  . . . . returns a new DateTime object.

  14. A.

     getdate()

    B.

     date_create()

    C.

     date_sunrise()

    D.

     date()


  15. It is always necessary to use parentheses with the print function.

  16. A.

     True

    B.

     False


  17. The below statement will return.

    $Var = substr(""abcdef"", -4, 1);

  18. A.

     returns "f"

    B.

     returns "d"

    C.

     returns "c"

    D.

     returns "cd"


  19. Returning values from functions may include .....

  20. A.

     Arrays

    B.

     Objects

    C.

     Both A & B

    D.

     None of above