Location: PHPKode > scripts > Hierarchy > hierarchy/example_simple.php
<?php

require_once(dirname(__FILE__).'/hierarchy.class.php');

// Create an array of item hierarchicaly
$list = array(
    'a' => array(
        'b' => false,
        'c' => false,
        'd' => false),
    'e' => array(
        'f' => false,
        'g' => false,
        'h' => array(
            'i' => false,
            'j' => false,
            'k' => false,
        ),
        'l' => false
    )
);

$list_hierarchicaly = hierarchy::print_list($list);

header('Content-type: text/html; charset=UTF-8');
echo <<<HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>Example</title>
<link rel="stylesheet" type="text/css" media="all" href="hierarchy.css.php" />
</head>
<body>
<h1>Simple List</h1>
<div style="border: 1px solid red; padding: 0 1em;">
{$list_hierarchicaly}
</div>
<p>You can print a list hierarchicaly.</p>
</body>
</html>
HTML;
Return current item: Hierarchy