Probably you need the whole code of the function:
function scanImages($id,$path,$picid) {
global $server, $images, $misc;
$childs = $server->children($id, "O.sort_order", "", 0);
for ($i = 0; $i < count($childs->results); $i++) {
$child = $server->object($childs->results[$i]);
switch ($child->type) {
case "183":
if($child->id == $picid){
$image = array();
$image[] = '"' . $child->id . '"';
$image[] = '"' . $child->name . '"';
$image[] = '"' . $misc->clean_path($child->file) . '"';
$image[] = '"' . $child->file_name . '"';
$image[] = '"' . $child->file_type . '"';
$image[] = '"' . $path . '"';
$images[] = implode("\t", $image);
}
break;
case "14":
scanImages($child->id,$path."/".$child->name);
break;
default:
};
};
}
scanImages(181,"Bilder", 20167);