php8.5
Home/ Manual/ rar / rararchive/ RarArchive::close

RarArchive::close

PHP function Edit on GitHub ✎

(PECL rar >= 2.0.0)

Close RAR archive and free all resources

Description

Oop (method):

RarArchive::close(): bool

Procedural:

rar_close(RarArchive $rarfile): bool

Close RAR archive and free all allocated resources.

Parameters

rarfile

A RarArchive object, opened with rar_open().

Return Values

Success

Changelog

VersionDescription
PECL rar 2.0.0The RAR entries returned by RarArchive::getEntry and RarArchive::getEntries are now invalidated when calling this method. This means that all instance methods called for such entries and not guaranteed to succeed.

Examples

Oop

php
<?php
$rar_arch = RarArchive::open('latest_winrar.rar');
echo $rar_arch."\n";
$rar_arch->close();
echo $rar_arch."\n";
?>

The above example will output something similar to:

output
RAR Archive "D:\php_rar\trunk\tests\latest_winrar.rar"
RAR Archive "D:\php_rar\trunk\tests\latest_winrar.rar" (closed)

Procedural

php
<?php
$rar_arch = rar_open('latest_winrar.rar');
echo $rar_arch."\n";
rar_close($rar_arch);
echo $rar_arch."\n";
?>

Source: reference/rar/rararchive/close.xml · from the official PHP manual (php/doc-en)