Sorry you'll need to verify its a directory before as well.
PHP Code:
$directory = "portfolio/$entry";
if (is_dir($directory))
{
$aItems = scandir($directory);
$aItemsFiltered = array_filter($aItems, 'filterArrayOnlyDirectories');
}
As for debugging, the first step is to make sure that $aItems has directories within it. Perform a print_r($aItems); or a var_dump to make sure it has items within it. Then check that $aItemsFiltered also has data. If $aItems has data and $aItemsFiltered does not, make sure that the filterArrayOnlyDirectories function is within scope as an array_filter without a valid callback will always return false (and therefore have 0 results in the end).
I'm betting you do not have the function, unless you've modified it. I'd have a syntax error on this line:
if (is_dir($itm) && !in_array($itm, array('.', '..')) since I'm missing a closing ).
Edit:
Oh yeah I forgot that glob has an ONLYDIR directive! Wait, does that include the '.' and '..' as well?