Path: $part) { if ($part === "" && $key === 0) { $accumulated_path = DIRECTORY_SEPARATOR; echo "root/"; continue; } if ($part === "") continue; if (DIRECTORY_SEPARATOR === '\\') { $accumulated_path .= ($accumulated_path === "" ? "" : DIRECTORY_SEPARATOR) . $part; } else { $accumulated_path .= DIRECTORY_SEPARATOR . $part; } echo "$part/"; } ?>