array_pop($Animals);
print_r($Animals);
?> , 1) Array ( [0] => Cow [1] => Cat [2] => Dog ),2) Array ( [0] => Cat [1] => Dog [2]=>Elephant ), 3) Both A or B, 4) error, "> array_pop($Animals);
print_r($Animals);
?> "/> array_pop($Animals);
print_r($Animals);
?> , Array ( [0] => Cow [1] => Cat [2] => Dog ), Array ( [0] => Cat [1] => Dog [2]=>Elephant ), Both A or B, error, "/>
Aptitude Reasoning English GK Computer Knowledge Programming Skill Banking Software Testing

Question

What will be the output of the following PHP code?
$Animals = array("Cow", "Cat", "Dog", "Elephant");
array_pop($Animals);
print_r($Animals);
?>
  • Array ( [0] => Cow [1] => Cat [2] => Dog )
  • Array ( [0] => Cat [1] => Dog [2]=>Elephant )
  • Both A or B
  • error
Answer- A

The array_pop() function deletes the last element of an array.