public function batchDelete($listId, array $emails)
    {
        $batchIds = [];
        // as suggested in MailChimp API docs, we send multiple smaller requests instead of a bigger one
        $emailsChunks = array_chunk($emails, self::SUBSCRIBER_BATCH_SIZE);
        foreach ($emailsChunks as $emailsChunk) {
            $Batch = $this->mailchimp->new_batch();
            foreach ($emailsChunk as $index => $email) {
                $emailHash = $this->mailchimp->subscriberHash($email);
                $Batch->delete("op$index", "lists/$listId/members/$emailHash");
            }
            $result = $Batch->execute();
            $currentBatch = $Batch->check_status();
            array_push($batchIds, $currentBatch['id']);
        }
        return $batchIds;
    }
public function batchDelete($listId, array $emails)
    {
        $batchIds = [];
        // as suggested in MailChimp API docs, we send multiple smaller requests instead of a bigger one
        $emailsChunks = array_chunk($emails, self::SUBSCRIBER_BATCH_SIZE);
        foreach ($emailsChunks as $emailsChunk) {
            $Batch = $this->mailchimp->new_batch();
            foreach ($emailsChunk as $index => $email) {
                $emailHash = $this->mailchimp->subscriberHash($email);
                $Batch->delete("op$index", "lists/$listId/members/$emailHash");
            }
            $result = $Batch->execute();
            $currentBatch = $Batch->check_status();
            array_push($batchIds, $currentBatch['id']);
        }
        return $batchIds;
    }
public function batchDelete ( $ listId , array $ emails ) { $ batchIds = [ ] ; // as suggested in MailChimp API docs, we send multiple smaller requests instead of a bigger one $ emailsChunks = array_chunk ( $ emails , self :: SUBSCRIBER_BATCH_SIZE ) ; foreach ( $ emailsChunks as $ emailsChunk ) { $ Batch = $ this -> mailchimp -> new_batch ( ) ; foreach ( $ emailsChunk as $ index => $ email ) { $ emailHash = $ this -> mailchimp -> subscriberHash ( $ email ) ; $ Batch -> delete ( "op$index" , "lists/$listId/members/$emailHash" ) ; } $ result = $ Batch -> execute ( ) ; $ currentBatch = $ Batch -> check_status ( ) ; array_push ( $ batchIds , $ currentBatch [ 'id' ] ) ; } return $ batchIds ; }
Delete a batch of Subscriber to a list
@param string $listId
@param array $emails
@return array $batchIds
Delete a batch of Subscriber to a list