I'm learning HTML, CSS, and PHP.

I' currently trying to write a script which lists all files inside a folder  
as an ordered list of download links.

Script works well, but after every list item with link it puts an extra  
empty item like this:

```
<ol>
    <li><a href="/~ftp/files/file1.txt">file1.txt</a></li>
    <li></li>
    <li><a href="/~ftp/files/file2.txt">file2.txt</a></li>
    <li></li>
</ol>

```

I cannot figure out why.  

Here is the page code:

```
<DOCTYPE html>
<html>
<head>
    <title>Files</title>
    <style>
        body {
            background-color: #D8DBE2;
        }
        div {
            margin: 0px;
            padding: 0px 5px;
            display: inline-block;
            background-color: white;
            border-style: none;
            border-radius: 6px 6px 0px 0px;
        }
        ol {
            margin: 0px;
            background-color: white;
            border-style: none;
            border-radius: 0px 6px 6px 6px;
            width: 500px;
            }
    </style>
</head>
<body>
    <div>
        <p><b>Files</b></p>
    </div>
    <ol>
        <?php
        $dir = '/home/ftp/public_html/files';
        $files = array_slice(scandir($dir),2); //getting rid of "." and ".."
        $s = sizeof($files);
        for ($i=0;$i<$s;$i++)
        {
            $file=implode("",array_slice($files,$i,1));
            echo "<li><a href=\"/~ftp/files/".$file."\">".$file."</a><li>";
        }
        ?>
    </ol>
</body>
</html>

```