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 postgresql 函数 returns the type id oid for the corresponding field numberphp tidy 函数 returns the number of tidy accessibility warnings encountered for specified documentphp yaz 函数 returns number of hits for last searchphp imagick returns the number of images in the objectphp imagickpixeliterator returns the current row of imagickpixel objectsphp mongodb driver writeresult returns the number of documents inserted excluding upserts php mongodb driver writeresult returns the number of documents selected for updatephp 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 solrquery returns the number of characters of fragments to consider for highlightingphp solrquery returns the maximum number of query terms that will be included in any generated queryphp 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 data associated with the current iterator 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
关注编程学问公众号