Phar::count

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

Phar::countReturns the number of entries (files) in the Phar archive

说明

public Phar::count ( void ) : int

参数

返回值

The number of files contained within this phar, or 0 (the number zero) if none.

范例

Example #1 A Phar::count() example

<?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

相关文章
php maxdb 函数 returns the number of parameter for the given statementphp mysqlnd qc 函数 returns information on the current handler the number of cache entries and cache entries if availablephp mongodb driver writeresult returns the number of existing documents updatedphp phar construct a phar archive from the files within a directoryphp phar compresses all files in the current phar archive using bzip2 compressionphp phar compresses all files in the current phar archive using gzip compressionphp phar compresses all files in the current phar archivephp phar returns the number of entries files in the phar archivephp phar decompresses all files in the current phar archivephp phar returns phar archive meta dataphp phar returns phar gz or phar bz2 if the entire phar archive is compressed .tar.gz/tar.bz and so on php phar returns true if the phar archive is based on the tar/phar/zip file format depending on the parameterphp phar returns true if the phar archive can be modifiedphp phar returns the full path on disk or full phar url to the currently executing phar archivephp phar uncompresses all files in the current phar archivephp pharfileinfo returns the actual size of the file with compression inside the phar archivephp solrinputdocument returns the number of fields in the documentphp solrquery returns the maximum number of characters of the field to returnphp solrquery returns the maximum number of tokens to parse in each document field that is not stored with termvector supportphp ziparchive counts the number of files in the achive
关注编程学问公众号