Public feed #379487

Unnamed

public text v1 · immutable
Raw Edit
·published 2007-03-03 08:50 UTC
rendered paste body
function display_list_recursive($var, $tabs = 0)
{
	echo str_repeat("\t", $tabs), "[list]\n";

	if (is_array($var))
		foreach ($var as $key => $value)
			if (is_array($value))
			{
				echo str_repeat("\t", $tabs), "[li]{$key}[/li]\n";
				display_list_recursive($value, $tabs++);
			}
			else
				echo str_repeat("\t", $tabs+1), "[li]{$key}[/li]\n";
	else
		echo str_repeat("\t", $tabs+1), "[li]{$var}[/li]\n";

	$tabs = $tabs - 1;
	echo str_repeat("\t", $tabs), "[/list]\n";
	$tabs = $tabs - 2;
}