php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
get_set_comments.php
Go to the documentation of this file.
1<?php
2
3copy('test_with_comment.zip', 't.zip');
5$z->open('t.zip');
6
8
9for ($i=0; $i<$z->numFiles; $i++) {
10 echo "index: $i\n";
11 print_r($z->getCommentIndex($i));
12 echo "\n\n";
13}
14echo "foobar/ " . $z->getCommentName('foobar/') . "\n";
15
16echo "Archive comment: " . $z->getArchiveComment() . "\n";
17
18
19$z->setCommentIndex(1, 'new comment idx 1');
20$z->setCommentName('foobar/', 'new comment foobar/');
21
22$z->setArchiveComment( 'new archive comment');
23
24for ($i=0; $i<$z->numFiles; $i++) {
25 echo "index: $i\n";
26 print_r($z->getCommentIndex($i));
27 echo "\n\n";
28}
29
30echo $z->getCommentName('foobar/') . "\n";
31
32// Get the original comment
33echo $z->getCommentName('foobar/', ZIPARCHIVE::FL_UNCHANGED) . "\n";
34
35echo "Archive comment: " . $z->getArchiveComment() . "\n";
36echo "Archive comment (original): " . $z->getArchiveComment(ZIPARCHIVE::FL_UNCHANGED) . "\n";
$z
Definition addglob.php:3
copy(string $from, string $to, $context=null)
print_r(mixed $value, bool $return=false)