PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Phar::createDefaultStub> <Phar::copy
Last updated: Fri, 05 Sep 2008

view this page in

Phar::count

(PECL phar:1.0.0-1.2.1)

Phar::countPhar アーカイブ内のエントリ (ファイル) の数を返す

説明

int Phar::count ( void )

パラメータ

返り値

この phar ファイルに含まれるファイルの数を返します。 存在しない場合は 0 (数字のゼロ) を返します。

例1 Phar::count() の例

<?php
// 存在しないことを確実にしておきます
@unlink('brandnewphar.phar');
try {
    
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar'0'brandnewphar.phar');
} catch (
Exception $e) {
    echo 
'phar を作成できません'$e;
}
echo 
'phar のエントリ数は ' $p->count() . " です\n";
$p['file.txt'] = 'hi';
echo 
'phar のエントリ数は ' $p->count() . " です\n";
?>

上の例の出力は以下となります。

phar のエントリ数は 0 です
phar のエントリ数は 1 です



add a note add a note User Contributed Notes
Phar::count
There are no user contributed notes for this page.

Phar::createDefaultStub> <Phar::copy
Last updated: Fri, 05 Sep 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites