Home

What is the correct answer?

4

What will be the output of the following PHP code?
 <?php  $a = array(A, Cat, Dog, A, Dog);
print_r(array_count_values($a));
?>

A.

Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )

B.

Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )

C.

Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )

D.

Array ( [A] => 2 [Cat] => 1 [Dog] => 1)

Correct Answer :

A.

Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )


The array_count_values() function counts all the values of an array.

Related Questions

What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following code?<?php $foo = 'Bob';… What is the default time(in seconds) for which session data is considered… What will be the output of the following PHP code ? <?php define('GOOD_OCTAL',… What will be the output of the following PHP code ? <?php $i = 0;while(++$i… What will be the output of the following PHP code? If say date is 22/06/2013.… PHP files have a default file extension of.. What will be the output of the following PHP code ? <?php define(GREETING,… What does PHP stand for?i) Personal Home Pageii) Hypertext Preprocessoriii)… To create an object and set the date to JUNE 22, 2013, which one of the… Which one of the following function is useful for producing a timestamp… What will be the output of the following PHP code? <?php $cars = array(Volvo,… If session.use_cookie is set to 0, this results in use of.. Which of following variables can be assigned a value to it?i) $3helloii)… What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code ? <?php define(GREETING,… What will be the output of the following code? If say date is 22/06/2013.… A PHP script should start with ___ and end with ___: What will be the output of the following PHP code ? <?php $i = 0;while… What will be the output of the following PHP code ? <?php $i = 5;while… Neglecting to set which of the following cookie will result in the cookies… What will be the output of the following PHP code ? <?php class Constants{… What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code ? <?php define(VAR_NAME,test);${VAR_NAME}… What will be the output of the following PHP code? <?php $a = array(a=>red,… Which one of the following function is used to start a session? What will be the output of the following PHP code? <?php $a = array(A,… If the format is F then which one of the following will be returned? Which function displays the web pages most recent modification date?