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 queue returns the number of values in the queuephp mysqlnd qc 函数 returns information on the current handler the number of cache entries and cache entries if availablephp sqlite 函数 returns the number of rows in a buffered result setphp mysqlnduhconnection returns the number of columns for the most recent queryphp 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 extract the contents of a phar archive to a directoryphp 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 sqlite3 returns the number of database rows that were changed or inserted or deleted by the most recent sql statementphp ziparchive returns the zip archive comment
关注编程学问公众号