(PHP >= 8.3.0, PECL zip >= 1.22.0)
ZipArchive::getArchiveFlag — Returns the value of a Zip archive global flag
public ZipArchive::getArchiveFlag(int $flag, int $flags = 0): int
Returns a Zip archive global flag value.
flag The global flag to retrieve, among AFL_* constants:
flags If flags is set to ZipArchive::FL_UNCHANGED, the original unchanged flag is returned.
Returns 1 if flag is set for archive, 0 if not, and -1 if an error occurred.
Example #1 Test if archive is a torrentzip format
<?php
$zip = new ZipArchive();
$res = $zip->open('test.zip');
if ($res === true) {
var_dump($zip->getArchiveFlag(ZipArchive::AFL_IS_TORRENTZIP));
} else {
echo 'Failed, code: ' . $res;
}
?>
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/ziparchive.getarchiveflag.php