Multi-Dimensional Array in PHP

We can access multiple values as well as multi-dimensional values by using Associative arrays in PHP .

Source code :

<?php
         $month = array( 
            "january" => array (
               "sunday" => 5,
               "monday" => 4,	
               "tuesday" => 4,
               "wednesday"=>4,
               "thursday"=>4,
               "friday"=>5,
               "saturday"=>5
            ),
            
           "february" => array (
               "sunday" => 4,
               "monday" => 5,	
               "tuesday" => 4,
               "wednesday"=>4,
               "thursday"=>4,
               "friday"=>4,
               "saturday"=>4
            ),
            
            "march" => array (
               "sunday" => 4,
               "monday" => 4,	
               "tuesday" => 5,
               "wednesday"=>5,
               "thursday"=>5,
               "friday"=>4,
               "saturday"=>4
            )
         );
         
        
         echo "No of sundays in january : " ;
         echo $month['january']['sunday']. "<br>"; 
        
         echo "No of sundays in february : " ;
         echo $month['february']['sunday'] . "<br>"; 
         
         echo "No of sundays in march : " ;
         echo $month['march']['sunday'] . "<br>"; 
      ?>
   

Output :

No of sundays in january :5
No of sundays in february :4
No of sundays in march :4

Output :


                

Comments :