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(“a”=>”red”, “b”=>”green”, “c”=>”blue”);
echo array_shift($a);
print_r ($a);
?>

What will be the output of the following PHP code?
<?php
$a = array(“a”=>”red”, “b”=>”green”, “c”=>”blue”);
echo array_shift($a);
print_r ($a);
?>
a) green
b) red
c) redArray( [c] => green [c] => blue )
d) redArray( [b] => green [c] => blue )

Answer: d
Explanation: The array_shift() function removes the first element from an array, and returns the value of the removed element.

Join The Discussion