Examveda
Examveda

What will be the output of the following PHP code?
<?php
$a = array("red", "green", "blue");
array_pop($a);
print_r($a);
?>

A. Array ( [0] => red [1] => green )

B. Array ( [0] => green [1] => blue )

C. Array ( [0] => red [1] => blue )

D. Array ( [0] => blue [1] => blue )

Answer: Option A

Solution(By Examveda Team)

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

This Question Belongs to PHP >> Arrays

Join The Discussion

Related Questions on Arrays