Examveda
Examveda

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);
?>

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.

This Question Belongs to PHP >> Arrays

Join The Discussion

Comments ( 4 )

  1. 286 Vaja
    286 Vaja :
    3 years ago

    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

  2. CS VN
    CS VN :
    3 years ago

    WHAT?
    [0] => NYC [1] => LA [2] => Paris

  3. CS VN
    CS VN :
    3 years ago

    correct is BBBBBBBB! please check again !

  4. CS VN
    CS VN :
    3 years ago

    the anser is wrong, please check it !!
    true is B

Related Questions on Arrays