mirror of
https://github.com/php/php-src.git
synced 2024-10-05 16:56:11 +00:00
28 lines
628 B
PHP
28 lines
628 B
PHP
<?php
|
|
|
|
$fname = dirname(__FILE__) . '/write6.phar';
|
|
@unlink($fname);
|
|
|
|
$phar = new Phar($fname);
|
|
$phar->setStub('<?php
|
|
$phar = new Phar(__FILE__);
|
|
$d = dirname(__FILE__) . "/copyonwrite6";
|
|
mkdir($d);
|
|
file_put_contents($d . "/file1", "file1\n");
|
|
file_put_contents($d . "/file2", "file2\n");
|
|
var_dump($phar->buildFromIterator(new RecursiveDirectoryIterator($d),$d));
|
|
$phar2 = new Phar(__FILE__);
|
|
$arr = array();
|
|
foreach ($phar2 as $name => $file) {
|
|
$arr[$name] = $file->getContent();
|
|
}
|
|
asort($arr);
|
|
foreach ($arr as $name => $content) {
|
|
echo $name, " ", $content;
|
|
}
|
|
echo "ok\n";
|
|
__HALT_COMPILER();
|
|
?>');
|
|
$phar['hi'] = "hi\n";
|
|
?>
|