Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

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

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: a
Explanation: The array_pop() function deletes the last element of an array.

Join The Discussion