(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 2.0.0)
PharData::offsetUnset — Remove a file from a tar/cip archive
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.
localName
The filename (relative path) to modify in the tar/cip archive.
No value is returned.
Throws PharException if there are any problems flushing changues made to the tar/cip archive to disc.
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
;
}
?>