Phar::count
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar::count — Phar 아카이브의 항목(파일) 수를 반환합니다.
설명
public Phar::count(int $mode
= COUNT_NORMAL
): int
매개변수
반환 값
이 phar 내에 포함된 파일의 수. 없는 경우 0(숫자 0).
Examples
예제 #1 Phar::count() 예제
<?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
} catch (Exception $e) {
echo 'Could not create phar:', $e;
}
echo 'The new phar has ' . $p->count() . " entries\n";
$p['file.txt'] = 'hi';
echo 'The new phar has ' . $p->count() . " entries\n";
?>
위의 예는 다음을 출력합니다.
The new phar has 0 entries The new phar has 1 entries