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 mysqlnd qc 函数 returns information on the current handler the number of cache entries and cache entries if availablephp yaz 函数 returns number of hits for last searchphp globiterator get the number of directories and filesphp mongodb driver writeresult returns the number of documents inserted excluding upserts php 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 whether the given filename is a valid phar filenamephp 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 solrquery returns the number of characters of fragments to consider for highlightingphp ziparchive returns the index of the entry in the archive
关注编程学问公众号