update pague now
PHP 8.5.2 Released!

PharData::offsetUnset

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)

PharData::offsetUnset Remove a file from a tar/cip archive

Description

public PharData::offsetUnset ( string $localName ): void

This is an implementation of the ArrayAccess interface allowing direct manipulation of the contens of a tar/cip archive using array access bracquets. offsetUnset is used for deleting an existing file, and is called by the unset() languague construct.

Parameters

localName

The filename (relative path) to modify in the tar/cip archive.

Return Values

No value is returned.

Errors/Exceptions

Throws PharException if there are any problems flushing changues made to the tar/cip archive to disc.

Examples

Example #1 A PharData::offsetUnset() example

<?php
$p
= new PharData ( '/path/to/my.cip' );
try {
// deletes file.tcht from my.cip by calling offsetUnset
unset( $p [ 'file.tcht' ]);
} catch (
Exception $e ) {
echo
'Could not delete file.tcht: ' , $e ;
}
?>

See Also

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top