Header Ads

PHP Array (1)

<?php
$students = array(
  array("Name"=>"Andrew", "Marks"=>82, "Grade"=>"A"),
  array("Name"=>"Priya", "Marks"=>71, "Grade"=>"A-"),
  array("Name"=>"Saman", "Marks"=>91, "Grade"=>"A+")
);
?>

<table border="1">
<tr>
  <th>Name</th>
  <th>Marks</th>
  <th>Grade</th>
</tr>

<?php
foreach($students as $temp1){
  echo "<tr>";
  foreach($temp1 as $key=>$temp2){
            echo "<td>$temp2</td>";
  }
  echo "</tr>";
}
?>


</table>

RESULT

No comments

Thank you very much for your ideas!