xref: /PHP-8.3/ext/zip/examples/extract.php (revision 58b17906)
1<?php
2if (!extension_loaded('zip')) {
3    dl('zip.so');
4}
5
6$zip = new ZipArchive();
7
8echo $zip->filename . "\n";
9$zip->open("test.zip");
10/*
11$zip->addFile("./modules/");
12$zip->addFile("./testempty");
13*/
14echo $zip->status . "\n";
15echo $zip->statusSys . "\n";
16
17echo $zip->numFiles . "\n";
18echo $zip->filename . "\n";
19var_dump($zip);
20$files = array('test', 'testdir/test2');
21if (!$zip->extractTo("./testext/path/to", $files)) {
22    echo "error!\n";
23    echo $zip->status . "\n";
24    echo $zip->statusSys . "\n";
25
26}
27
28$zip->close();
29