PHP Arrays


  1. What will be the output of the following PHP code?
    <?php
    $Country = array("India", "England", "USA");
    echo "I like " . $Country[2] . ", " . $Country[1] . " and " . $Country[0] . ".";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The order of elements defined.


  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. 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 returns an array consisting of associative key/value pairs?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    array_count_values()



  1. What will be the output of the following PHP code?
    <?php
    $Flower = array ("Rose", "Lily ", "Sunflower");
    echo (next($Flower));
    echo (next($Flower));
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    The next() function returns the array value residing at the position immediately following that of the current array pointer.