Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created July 9, 2020 00:19
Show Gist options
  • Save luisenriquecorona/b582546812ff3cd3c87cda15656103bc to your computer and use it in GitHub Desktop.
Save luisenriquecorona/b582546812ff3cd3c87cda15656103bc to your computer and use it in GitHub Desktop.
<?
include_once("libs/smarty.class.php");
$smarty = new smarty();
$students = array(
"didar" => array("name"=>"Didar Bhuiyan","roll"=>12),
"emran" => array("name"=>"Emran Hasan","roll"=>18),
"hasan" => array("name"=>"Tanveer Hasan","roll"=>23));
$smarty->assign("students",$students);
$smarty->display("associative_array.tpl");
?>
<html>
<body>
<table>
<tr><td>Name</td><td>Roll</td></tr>
{foreach item=student from=$students}
<tr>
<td>{$student.name}</td>
<td>{$student.roll}</td>
</tr>
{/foreach}
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment