What will be the output of the following PHP code?
<?php
$fruits = array ("apple", "mango", "peach", "pear", "orange");
$subset = array_splice ($fruits, 2);
print_r ($fruits);
?>
<?php
$fruits = array ("apple", "mango", "peach", "pear", "orange");
$subset = array_splice ($fruits, 2);
print_r ($fruits);
?>
A. Error
B. Array ( [0] => apple [1] => mango [2] => peach )
C. Array ( [0] => apple [1] => mango )
D. Array ( [0] => pear [1] => orange )
Answer: Option C
Solution(By Examveda Team)
The array_splice() function removes all elements of an array found within a specified range.Related Questions on Arrays
A. karnataka 11,35,000
B. 11,35,000
C. population 11,35,000
D. karnataka population
Which function will return true if a variable is an array or false if it is not?
A. this_array()
B. is_array()
C. do_array()
D. in_array()
Join The Discussion