Which PHP function is used to sort an array in ascending order, maintaining the key-value pairs?
A). sort()
B). ksort()
C). asort()
D). rsort()
What is the output of the following PHP code?<?php
$colors = array('Red', 'Green', 'Blue');
echo $colors[1];
?
A). Red
B). Green
C). Blue
D). 1
Which PHP function is used to extract a slice of an array?
A). splice()
B). slice()
C). extract()
D). split()
Which PHP function is used to remove the last element from an array?
A). remove()
B). pop()
C). delete()
D). unset()
What is the purpose of the array_push() function in PHP?
A). To remove elements from an array
B). To add elements to the beginning of an array
C). To add elements to the end of an array
D). To reverse the order of elements in an array
What will be the output of the following PHP code?<?php
$matrix = array(
array(1, 2, 3),
array(4, 5, 6),
array(7, 8, 9)
);
echo $matrix[1][2];
?
A). 1
B). 2
C). 4
D). 6
Which PHP function is used to determine the number of elements in an array?
A). size()
B). count()
C). length()
D). elements()
Which PHP function is used to merge two or more arrays into a single array?
A). merge()
B). combine()
C). concat()
D). array_merge()
What is the correct way to access the first element of an indexed array in PHP?
A). $array[0]
B). $array[1]
C). $array['first']
D). $array['0']
What will be the output of the following PHP code?<?php
$numbers = array(10, 20, 30, 40, 50);
echo count($numbers);
?
A). 10
B). 20
C). 5
D). 50