SplObjectStorage::count

(PHP 5 >= 5.1.0, PHP 7)

SplObjectStorage::countReturns the number of objects in the storage

说明

public SplObjectStorage::count ( void ) : int

Counts the number of objects in the storage.

参数

此函数没有参数。

返回值

The number of objects in the storage.

范例

Example #1 SplObjectStorage::count() example

<?php
$s 
= new SplObjectStorage();
$o1 = new StdClass;
$o2 = new StdClass;

$s->attach($o1);
$s->attach($o2);
$s->attach($o1);
var_dump($s->count());
var_dump(count($s));
?>

以上例程的输出类似于:

int(2)
int(2)

参见

相关文章
php datetimeinterface returns the difference between two datetime objectsphp informix 函数 returns the number of columns in the queryphp maxdb 函数 returns the number of parameter for the given statementphp postgresql 函数 returns the type id oid for the corresponding field numberphp tidy 函数 returns the number of tidy accessibility warnings encountered for specified documentphp tidy 函数 returns the number of tidy configuration errors encountered for specified documentphp mongodb driver writeresult returns the number of documents selected for updatephp mongodb driver writeresult returns the number of existing documents updatedphp mysqli stmt returns the number of parameter for the given statementphp mysqlnduhconnection returns the number of warnings from the last query for the given linkphp 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 query terms that will be included in any generated queryphp solrquery returns the maximum number of tokens to parse in each document field that is not stored with termvector supportphp splobjectstorage adds all objects from another storagephp splobjectstorage returns the number of objects in the storagephp splobjectstorage returns the current storage entryphp splobjectstorage returns the index at which the iterator currently isphp splobjectstorage removes objects contained in another storage from the current storagephp splobjectstorage removes all objects except for those contained in another storage from the current storage
关注编程学问公众号