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

search for in the

Phar::createDefaultStub> <Phar::copy
[edit] Last updated: Fri, 07 Jun 2013

view this page in

Phar::count

(PHP >= 5.3.0, PECL phar >= 1.0.0)

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 - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites