Affichage de tableau
Posté : 08 déc. 2013, 17:08
Bonjour,
je suis débutant en php
, et j'essaye d'afficher le contenu d'un tableau associatif, cependant je ne comprends pas pourquoi en résultat il m'affiche : "array,array,array..." au lieu de m'afficher le contenu du tableau. Pouvez vous m'aider ?
Voici mon code :
Merci beaucoup
je suis débutant en php
Voici mon code :
<?php
error_reporting(E_ALL);
ini_set('display_errors','true');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>titre</title>
<link rel="stylesheet" type="text/css" href="fichier.css" />
</head>
<body>
<?php
function display($tableau)
{
foreach($tableau as $v)
{
echo $v." ";
}
print_r($tableau);
}
$t = array(
array("D","U","T"),
array("I","N","F","O"),
array("G","E","E","K"),
array("S","C","H","O","O","L")
);
display($t);
?>
</body>
</html>
J'ai aussi essayé un foreach($tableau as $k=>$v){ echo $v." ";} mais sans résultatMerci beaucoup