Examveda
Examveda

What will be the output of the following php code?
<?php
$states = array("karnataka" => array( "population" => "11,35,000", "captial" => "Bangalore"),"Tamil Nadu" => array( "population" => "17,90,000","captial" => "Chennai") );
echo $states["karnataka"]["population"];
?>

A. karnataka 11,35,000

B. 11,35,000

C. population 11,35,000

D. karnataka population

Answer: Option B

Solution(By Examveda Team)

Treat states as a multidimensional array and accordingly traverse it to get the value.

Join The Discussion

Related Questions on Arrays

What will be the output of the following PHP code?

A. Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )

B. Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )

C. Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )

D. Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )