PHP Arrays
1. | What is an array in PHP? |
---|
A. A collection of similar data types
B. A collection of different data types
C. A variable that can hold only one value at a time
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
2. | Which of the following is the correct syntax to create an array in PHP? |
---|
A. $array = array("apple", "banana", "orange");
B. $array = ["apple", "banana", "orange"];
C. Both A and B
D. None of the above
View Answer Discuss Work SpaceAnswer: option c
Explanation:
3. | How can you access the first element of an array in PHP? |
---|
A. $array[0]
B. $array[1]
C. $array[first]
D. $array["first"]
View Answer Discuss Work SpaceAnswer: option a
Explanation:
4. | What is the function used to add an element to the end of an array in PHP? |
---|
A. array_push()
B. array_add()
C. add_array()
D. array_append()
View Answer Discuss Work SpaceAnswer: option a
Explanation:
5. | Which function is used to remove the last element from an array in PHP? |
---|
A. array_shift()
B. array_pop()
C. array_remove_last()
D. remove_array_last()
View Answer Discuss Work SpaceAnswer: option b
Explanation: