PHP Arrays


  1. What will be the output of the following PHP code?
    <?php
    $Employee = array ("Ajit", "Abhay", array ("Prayag", "Imroj"),
    "krishana");
    echo (count($Employee, 1));
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The array entity holding pear and mango is counted as an item, just as its contents are.


  1. Which function can be used to move the pointer to the previous array position?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    prev()



  1. Which function will return true if a variable is an array or false if it is not?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    A built-in function, is_array(), is available for testing an array. Its prototype follows: boolean is_array(mixed variable).


  1. PHP’s numerically indexed array begin with position ___________.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Like many programming languages, the first element of an array has an index value of 0.



  1. Which of the following are correct ways of creating an array?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    A variable name should start with $ symbol which is not present in C) and you need not put the square brackets when you use the array() constructor.