1<?php
2
3$fname = dirname(__FILE__) . '/write.phar';
4@unlink($fname);
5
6$phar = new Phar($fname);
7$phar->setStub('<?php
8$phar = new Phar(__FILE__);
9echo $phar["test.txt"]->getContent();
10$phar["test.txt"] = "changed
11";
12echo $phar["test.txt"]->getContent();
13echo "ok\n";
14__HALT_COMPILER();
15?>');
16$phar->setMetadata('hi');
17$phar['test.txt'] = "hi
18";
19$phar['test.txt']->setMetadata('hi');
20?>
21