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 deque returns the number of values in the collectionphp frontbase 函数 returns the error number from previous operationphp mssql 函数 returns the number of records affected by the queryphp mysqlnd qc 函数 returns information on the current handler the number of cache entries and cache entries if availablephp sqlite 函数 returns the number of rows that were changed by the most recent sql statementphp mysqli stmt returns the total number of rows changed deleted or inserted by the last executed statementphp 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 splobjectstorage returns the number of objects in the storage
关注编程学问公众号