PHP OOP mt_rand() function do it twice by calling method

I write a class for doing FTP stuff When i calling a method from my class to make an directory on FTP, it creates the folder two times if i'm using the mt_rand() function. I use mt_rand() to create unique id/name for my folder to prevent duplicates.

I'm trying also uniqid() function but have the same result. What i'm doing wrong?

Here is my class:

class Ftp
{
   private $host;
   private $username;
   private $password;
   private $port;
   private $mode;
   private $stream;
   private $connected;
   private $Createdir;
   private $subdir;
   private $files;
   
   // make FTP connection
   function __construct( $host, $username, $password, $port = 21, $mode){
       $this->host      = $host;
       $this->username  = $username;
       $this->password  = $password;
       $this->port      = $port;
       $this->mode      = $mode;
   }

   // FTP connect
   protected function connect(){
       return ftp_connect($this->host, $port);
   }

   // FTP login and create connection
   public function open(){
       $connect = $this->connect();

       if ( $connect == false ){
           // give a error if connection failed
            die( "Kan niet verbinden met " . $this->host );
       }
       if( ftp_login($connect, $this->username, $this->password) ){
            $this->stream = $connect;
            $this->connected = true;
       }
   }

   // create folder
   public function create_folder( $temp_dir ){

        $this->Createdir = $temp_dir;
/*         if( ftp_mkdir( $this->stream, $this->Createdir ) ){
            return true;
        } */
        /* if( $this->folder_exists() === false ) {
            
        } */
        
        //return false;
        
   }
   
   // create subfolder
   public function create_subfolder( $dir ){

       $this->subdir    = $dir;     

       if ( ftp_chdir( $this->stream, $this->Createdir ) ){
           if ( ftp_mkdir( $this->stream, $this->subdir ) ){
               return $this->subdir;
           }
       }

   }

   // check if folder exists
   protected function folder_exists(){
       if ( ftp_chdir( $this->stream, $this->Createdir ) ){
           return true;
       }

       return false;
   }

   // upload files
   public function upload( $files ){
       $this->files = $files;
       if ( ftp_put( $this->stream, $this->Createdir, $this->files) ){
           return true;
       }
   }

   // close FTP connection
   public function __destruct(){
        if( $this->connected ){
            ftp_close($this->stream);
        }
   }
}

    
    $unique_id = date("Y-m-d",time()) ."_". $_POST["prod_id"] ."_".uniqid(); // creating unique dir into temp_files
    $ftp = new Ftp( get_option("ftp_host"), get_option("ftp_user"), get_option("ftp_pass") , 21, get_option("ftp_mode"));
    $ftp->open();
    $ftp->create_folder('temp_files');
    $ftp->create_subfolder($unique_id);