Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
What is the output of the following PHP code snippet?
<?php$array = ["apple", "banana", "orange"];echo count($array);?>
0
1
2
3
unset()
array_splice()
array_remove()
array_shift()
<?php$array1 = ["apple", "banana"];$array2 = ["orange", "grape"];$result = array_merge($array1, $array2);print_r($result);?>
["apple", "banana"]
["orange", "grape"]
[0=>"apple", 1=>"banana", 2=>"orange", 3=>"grape"]
None of the above
array_pop()
array_remove_last()
remove_array_last()
sort()
asort()
ksort()
rsort()
<?php$array = ["apple", "banana", "orange"];$last_element = end($array);echo $last_element;?>
apple
banana
orange
in_array()
array_exists()
value_in_array()
array_contains()
<?php$array = ["apple", "banana", "orange"];$subset = array_slice($array, 1, 2);print_r($subset);?>
["apple"]
["banana"]
["orange"]
["banana", "orange"]
<?php$array = ["apple", "banana", "orange"];$lengths = array_map('strlen', $array);print_r($lengths);?>
["a", "b", "o"]
[5, 6, 6]
["apple", "banana", "orange"]
$array[0]
$array[1]
$array[first]
$array["first"]