<?php

    $path = getcwd();
    $directories = array();
    
    try
    {
        $dirIterator = new DirectoryIterator($path);
    
        foreach ($dirIterator as $fileinfo)
        {
            // Use isDir() and isDot() methods to filter
            if ($fileinfo->isDir() && !$fileinfo->isDot())
            {
                $directories[] = $fileinfo->getFilename(); // or $fileinfo->getPathname() for full path
            }
        }
    
        //echo getcwd(); // /home/kayacdn/public_html/buckets
        //echo '<br>';
        //print_r($directories); // ( [0] => santakaya [1] => us [2] => medkayafarma [3] => binolgold [4] => geral )
    
    }
    catch (Exception $e)
    {
        echo 'Error: ' . $e->getMessage();
    }

?>