Home

What is the correct answer?

4

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 )

Correct Answer :

D.

redArray( [b] => green [c] => blue )


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

Related Questions

What will be the output of the following PHP code ? <?php class Constants{… If the directive session.cookie_lifetime is set to 3600, the cookie will… What will be the output of the following PHP code? <?php $cars = array(Volvo,… What will be the output of the following PHP code? <?php $age = array(Peter=>35,… What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code? <?php $a1 = array(red,… What will be the output of the following PHP code ? <?php $i = 2;while… Which of the following is/are a PHP code editor?i) Notepadii) Notepad++iii)… What is the default number of seconds that cached session pages are made… What will be the output of the following PHP code? <?php $a = array(A,… What will be the output of the following PHP code ? <?php define('IF',… What will be the output of the following code? If say date is 22/06/2013.… What will be the output of the following PHP code ? <?php $i = 0;while… Which function displays the web pages most recent modification date? What will be the output of the following PHP code? <?php $a = array(a=>red,… What will be the output of the following PHP code? <?php $a1 = array_fill(3,… If session.use_cookie is set to 0, this results in use of.. What is the default time(in seconds) for which session data is considered… What will be the output of the following PHP code ? <?php $color =… What will be the output of the following PHP code ? <?php define('GREETING_TEST',… If the format is F then which one of the following will be returned? What will be the output of the following PHP code? If say date is 22/06/2013.… What will be the output of the following PHP code ? <?php define(NEW_GOOD_NAME_CONSTANT,… How many ways can a session data be stored? What will be the output of the following PHP code ? <?php class myObject… What will be the output of the following PHP code? <?php echo (checkdate(4,31,2010)… What will be the output of the following PHP code ? <?php $i = 5;while… What will be the output of the following PHP code ? <?php $color1 =… What does PHP stand for?i) Personal Home Pageii) Hypertext Preprocessoriii)… Which directive determines how the session information will be stored?