What will be the output of the following PHP code?
<?php
$place = array("NYC", "LA", "Paris");
array_pop($place);
$place1 = array("Paris");
$place = array_merge($place, $place1);
print_r($place);
?>
<?php
$place = array("NYC", "LA", "Paris");
array_pop($place);
$place1 = array("Paris");
$place = array_merge($place, $place1);
print_r($place);
?>
A. Array ( [0] => LA [1] => Paris [2] => Paris )
B. Array ( [0] => NYC [1] => LA [2] => Paris)
C. Array ( [0] => NYC [1] => LA [2] => Paris [3] => Paris )
D. None of the mentioned
Answer: Option A
Solution(By Examveda Team)
array_merge() and array_pop() yields that result.Join The Discussion
Comments ( 4 )
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()
That's a wrong answer array_pop() is popped last array element and array_merge() is combining the both array so Correct answer is B
WHAT?
[0] => NYC [1] => LA [2] => Paris
correct is BBBBBBBB! please check again !
the anser is wrong, please check it !!
true is B