如何制作一个表来组织PHP中的按钮

I have this code which creates buttons from files in a directory. I need to organize them in a table with 4 columns. How can I do this?

Here is my code:

$handle = opendir('mydirectory');

if($handle){
    while(($entry = readdir($handle)) !== false){
        if($entry != '.' && $entry != '..' && $entry != '.htaccess'){

       echo "<button onclick=\"location.href='mydirectory/$entry'\"    style=\"background-color: #660000;\"><p style=color:white;>$entry</button><br>";

        }
    }
    closedir($handle);

Taking what @Raptor mentioned in the comments you could do something like this:

<style>
#buttons{
  width: 300px;
  float:left;
}
</style>
<div id="buttons">
<?php
for($i=0;$i <=10; $i++){
  echo "<button>Button $i</button>";
}
?>
</div>

enter image description here