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 eio 函数 returns number of finished but unhandled requestsphp ftp 函数 returns a list of files in the given directoryphp imap 函数 this function returns the uid for the given message sequence numberphp mysqlnd qc 函数 returns information on the current handler the number of cache entries and cache entries if availablephp svn 函数 enumerates the directory entries under path; returns a hash of dir names to file typephp svn 函数 returns list of directory contents in repository url optionally at revision numberphp 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 phardata decompresses the entire phar archivephp pharfileinfo returns the actual size of the file with compression inside the phar archive
关注编程学问公众号