Не, key си има стойност, но всичко е малко оплетено
<?php
$dir=array("school","personal","other");
foreach($dir as $key){
$handle = opendir("gallery/cats/$key");
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "index.html" && $file != "Thumbs.db") {...