Jump to content

printing 2 dimentional array


stijn0713

Recommended Posts

I try to write a small function to print a two dimentional array but it doesn't print the value of the array, even if i use the double quotes for variable substituation?

 

<?php 

function printvierkantematrix($matrix, $m, $n){

$tabel = "<table>";

for ($y = 0; $y <= $m-1; $y++){

	$tabel .= "<tr>";

	for ($i = 0; $i <= $n-1; $i++){	

		$tabel .= "<td>$matrix[$y][$i]</td>";	
}

	$tabel .= "</tr>";

	}
$tabel .= "</table>";

echo $tabel;

}
?>

.

 

What's wrong? Is this not a good way of printing arrays?

Link to comment
https://forums.phpfreaks.com/topic/264689-printing-2-dimentional-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.