public function folderSize(string $dir):int
    {
        $size = 0;
        foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
            $size += is_file($each) ? filesize($each) : $this->folderSize($each);
        }
        return ($size);
    }
public function folderSize(string $dir):int
    {
        $size = 0;
        foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
            $size += is_file($each) ? filesize($each) : $this->folderSize($each);
        }
        return ($size);
    }
public function folderSize ( string $ dir ) : int { $ size = 0 ; foreach ( glob ( rtrim ( $ dir , '/' ) . '/*' , GLOB_NOSORT ) as $ each ) { $ size += is_file ( $ each ) ? filesize ( $ each ) : $ this -> folderSize ( $ each ) ; } return ( $ size ) ; }
Get size folder
@param string $dir Dir path
@return int folder size
Get size folder