Create HTML table from PHP Multidimensional array

I have a multidimensional array that is being built pulled from a file structure.

I am trying to use this array to create dynamic HTML tables based on the key for each item. The script I am using to pull the file structure is making each folder into the keys of the array.

So the array is outputting like this:

	'array([english] => Array
	    (
	        [term1] => Array
	            (
	                [circ] => Array
	                    (
	                        [Unit1] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit2] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit3] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit4] => Array
	                            (
	                                [0] => file.zip
	                            )

	                    )

	                [type] => Array
	                    (
	                        [Unit1] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit2] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit3] => Array
	                            (
	                                [0] => file.zip
	                           )

	                        [Unit4] => Array
	                            (
	                                [0] => file.zip
	                            )

	                    )

	            )

	        [term2] => Array
	            (
	                [circ] => Array
	                    (
	                        [Unit1] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit2] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit3] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit4] => Array
	                            (
	                                [0] => file.zip
	                            )

	                    )

	                [type] => Array
	                    (
	                        [Unit1] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit2] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit3] => Array
	                            (
	                                [0] => file.zip
	                            )

	                        [Unit4] => Array
	                            (
	                                [0] => file.zip
	                            )

	                    )

	            )
	        )
	    )'

What I am trying to output is a page with a table that will use the keys something like this.

title = engligh
heading 1 = term1
heading 2 = circ
content 1 =
content 2 = Unit1
content 2 = Unit2
link = file.zip

	<table class="table table-hover">
	    <thead>
	        <th>{heading1}</th>
	        <th>{heading2}</th>
	    </thead>
	    <tbody>
	        <tr>
	            <td>{content1}</td>
	            <td><a href="{link}">{content2}</a></td>
	        </tr>
	   </tbody>
	</table>

I have been working through other examples and guides that I have found however I have not yet gotten more than the first level to print.

I have not used PHP in over 5 years, I am not a PHP developer nor do I want to become one, I have simply been thrown in the deep end at work and need some help to make this happen so any help given is very much appreciated!

Edit
So I have created a function that is pulling the first 2 level of keys from the array, however when I added in a third level it is just repeating the second level. I think recursive is more along the lines of what I need however I can not get my head around that.

function recursive(array $array){
    foreach($array as $key => $value){
        echo $key, '<br>';
        //If $value is an array.
        if(is_array($value)){
            //We need to loop through it.
            foreach($value as $key1 => $value1) {
                echo ' - ' . $key1, '<br>';
                //if $value is an array.
                if(is_array($value1)){
                    foreach ($value1 as $key2 => $value2) {
                        echo '   - ' . $key2, '<br>';
                    }
                }else{
                    echo ' - ' . $key1, '<br>';
                }
            }
        } else{
            //It is not an array, so print it out.
            echo $key, '<br>';
        }
    }
}

Try this:

<?php 
$title = 'Array to Dynamic Table';
$tmps = array
(
    'english' => Array
    (
      'term1' => 
        Array('circ' => Array
        (
            'Unit1' => Array('0' => 'file.zip'),
            'Unit2' => Array('0' => 'file.zip'),
            'Unit3' => Array('0' => 'file.zip'),
            'Unit4' => Array('0' => 'file.zip'),
        ),
        'type' => Array
        (
            'Unit1' => Array('0' => 'file.zip'),
            'Unit2' => Array('0' => 'file.zip'),
            'Unit3' => Array('0' => 'file.zip'),
            'Unit4' => Array('0' => 'file.zip'),
        )
    ),
    'term2' => Array
    (
        'circ' => Array
        (
            'Unit1' => Array('0' => 'file.zip'),
            'Unit2' => Array('0' => 'file.zip'),
            'Unit3' => Array('0' => 'file.zip'),
            'Unit4' => Array('0' => 'file.zip'),
        ),
        'type' => Array
        (
            'Unit1' => Array('0' => 'file.zip'),
            'Unit2' => Array('0' => 'file.zip'),
            'Unit3' => Array('0' => 'file.zip'),
            'Unit4' => Array('0' => 'file.zip'),
        ),
    ),
),
);

// BEWARE - DO NOT HAVE ANYTHING AFTER TMP;, NOT EVEN A SPACE
echo $html = <<< TMP
<!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"  lang="EN" xml:lang="EN">
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en"/>
<style type="text/css">
  table    {margin:-1em 0 2em 4.2em;}
  table td,
  table th {padding:0 1em; border:solid 1px #333; text-align:center;}
</style>
<title> $title </title>
</head>
<body>
TMP;
// BEWARE - DO NOT HAVE ANYTHING AFTER TMP;, NOT EVEN A SPACE

echo '<h1>' .$title .'</h1>';
// BEWARE - DO NOT HAVE ANYTHING AFTER TMP, NOT EVEN A SPACE
echo $table = <<< TMP
    <table>
        <tr>
        <th> Language     </th>
        <th> heading 1     </th>
        <th> heading 2     </th>
        <th> content         </th>
        <th> item             </th>
        <th> file             </th>
    </tr>
TMP;
// BEWARE - DO NOT HAVE ANYTHING AFTER TMP;, NOT EVEN A SPACE

foreach($tmps as $item1 => $name1):
    foreach($name1 as $item2 => $name2):
        foreach($name2 as $item3 => $name3):
            foreach($name2 as $item4 => $name4):
                foreach($name4 as $item5 => $name5):
                    foreach($name5 as $item6 => $name6):
                        echo '<tr>';
                            echo '<td>' .$item1 .'</td>'; // english
                            echo '<td>' .$item2 .'</td>'; // term1, 
                            echo '<td>' .$item2 .'</td>'; // term1, 
                          echo '<td>' .$item5 .'</td>'; // unit1
                          echo '<td>' .$item6 .'</td>'; // 0
                          echo '<td>' .$name6 .'</td>'; // file.zip
                      echo '</tr>';
                    endforeach;        
                endforeach;        
            endforeach;        
        endforeach;        
    endforeach;        
endforeach;

echo '</table></body></html>';

Thank you and sorry, I have realised that what I asked for wasn’t going to work in the overall scheme of what I was trying to do, I will have to go back to the drawing board and rethink what I need.