ZipArchive::getArchiveFlag

Returns the value of a Zip archive global flag

&reftitle.description; public `int` `ZipArchive::getArchiveFlag` `int` `flag` `int` `flags` 0

Returns a Zip archive global flag value.

&reftitle.parameters;

`flag`

- The global flag to retrieve, among `AFL_*` constants:

  - `ZipArchive::AFL_RDONLY`

  - `ZipArchive::AFL_IS_TORRENTZIP`

  - `ZipArchive::AFL_WANT_TORRENTZIP`

  - `ZipArchive::AFL_CREATE_OR_KEEP_FILE_FOR_EMPTY_ARCHIVE`

`flags`

- If `flags` is set to `ZipArchive::FL_UNCHANGED`, the original unchanged flag is returned.

&reftitle.returnvalues;

Returns 1 if flag is set for archive, 0 if not, and -1 if an error occurred.

&reftitle.examples;

### 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;
    }

    ?>

&reftitle.seealso;

- `ZipArchive::setArchiveFlag`