How am I able to create multidimensional array

Hi, I want to print the table, but my code does not work, can anyone tell me what else do I need to add into the code?

<!DOCTYPE html>
<html>
    <head>
        <title>tutorial</title>
    </head>
    <body>
    <?php
    	$point = array(
				"John" => array(
						"Unit1" => "76",
						"Unit2" => "62",
						"Unit3" => "56",
						"Unit4" => "60",
				),
				"Tom" => array(
						"Unit1" => "62",
						"Unit2" => "82",
						"Unit3" => "56",
						"Unit4" => "47",
				),
				"Jane" => array(
						"Unit1" => "52",
						"Unit2" => "62",
						"Unit3" => "66",
						"Unit4" => "80",
				),
				"Jess" => array(
						"Unit1" => "72",
						"Unit2" => "52",
						"Unit3" => "72",
						"Unit4" => "65",
				),
			
		foreach ($point as $name => $therest)
		{
			echo $name;
	
		
		foreach ($therest as $unit => $score)
		{
			echo $unit;
		}

		echo $score;

		}
    ?>
    </body>
</html>

This is the example that I want:

Firstly when you define the array, you end with a comma, which should not be on the last entry. You are also missing a closing bracket for the top level of the array.

Where you echo the values there is no HTML to create an actual table.
You need to create a table structure and echo the values into that.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.