Displaying a Multidimensional Array using For each : Multidimensional Array « Data Structure « PHP






Displaying a Multidimensional Array using For each

<?php
  $emp_det = array (array (Name=>"a", Code=> "8", Hobby=> "A"),
                    array (Name=>"b", Code=> "8", Hobby=> "B"),
                    array (Name=>"c", Code=> "1", Hobby=> "C"),
                    array (Name=>"d", Code=> "3", Hobby=> "D"),
  );
  foreach ($emp_det as $tempone) {
    foreach ($tempone as $key=>$temptwo) {
      echo "$key: $temptwo", "\n";
    }
    echo "\n";
  }
?>

           
       








Related examples in the same category

1.Reference element in multidimensional Arrays
2.Defining a Multidimensional Array
3.Looping Through a Multidimensional Array
4.Accessing multidimensional array elements
5.Creating Multidimensional Arrays
6.Creating a Multidimensional Array
7.Sorting Multidimensional Arrays
8.Multidimensional array element value interpolation
9.Displaying Multidimensional Arrays
10.Displaying a multidimensional array
11.Find the Maximum Value in a Multidimensional Array
12.Generating fixed-width field data records without
13.Manipulating multidimensional arrays