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

CSE :: PHP - CS

  1. A function in PHP which starts with ______ (double underscore) is know as.

  2. A.

     Magic Function

    B.

     Inbuilt Function

    C.

     Default Function

    D.

     User Defined Function


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

    <?php

    function foo($msg)

    {

    echo "$msg";

    }

    $var1 = "foo";

    $var1("will this work");

    ?>

  4. A.

     Error

    B.

     $msg

    C.

     0

    D.

     Will this work


  5. Which one of the following PHP functions can be used to build a function that accepts any number of arguments?

  6. A.

     func_get_argv()

    B.

     func_get_argc()

    C.

     get_argv()

    D.

     get_argc()


  • Which one of the following PHP functions can be used to find files?

  • A.

     glob()

    B.

     file()

    C.

     fold()

    D.

     get_file()


  • Which of the following PHP functions can be used to get the current memory usage?

  • A.

     get_usage()

    B.

     get_peak_usage()

    C.

     get_memory_usage()

    D.

     get_memory_peak_usage()


  • Which of the following PHP functions can be used for generating unique id’s?

  • A.

     uniqueid()

    B.

     id()

    C.

     md5()

    D.

     mdid()


  • Which one of the following functions can be used to compress a string?

  • A.

     zip_compress()

    B.

     zip()

    C.

     compress()

    D.

     gzcompress()


  • What will be the output of the following PHP code?

    <?php

    echo "chr(52)";

    ?>

  • A.

     1

    B.

     2

    C.

     3

    D.

     4


  • What will be the output of the following PHP code?

    <?php

    echo ord ("hi");

    ?>

  • A.

     106

    B.

     103

    C.

     104

    D.

     209


  • What will be the output of the following PHP code?

    <?php

    $str = "Hello World"

    echo wordwrap($str,5,"n");

    ?>

  • A.

     Hello World

    B.

     Hello
    World

    C.

     Hell 0 Wo rld

    D.

     World