I have this script which arranges my folders in some tags and takes only 4 items.. which is great! But I need it to take the items by the alphabet
$counter = 0;
$directory = opendir("albums/");
while (($item = readdir($directory)) !== false && $counter < 4) {
if (($item != ".") && ($item != "..")){
$files[] = $item;
//..
$counter++;
}
}
I have this script and I would like to combine or replace it with
$items = glob("albums/*", GLOB_ONLYDIR);
{
foreach($items as $item)
{
//..
}
}
How can i do it? Glob function is new to me...