I have a list of folders but want to group them by first letter ie all A folders together, all B folder together etc:
$handle = opendir(".");
$projectContents = '';
while ($file = readdir($handle))
{
if (is_dir($file) && !in_array($file,$projectsListIgnore))
{
$projectContents .= '<li><a href="'.$file.'">'.$file.'</a></li>';
}
}
closedir($handle);
Output:
<ul>
$projectContents
</ul>
The above snippet lists them fine from a-2-z but I don't know how to section them off into groups.
The closing and re-opening of </ul><ul>
with each new letter section would be enough but again don't kow how to impliment into the current snippet.