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 deque returns the number of values in the collectionphp ibm db2 函数 returns the number of fields contained in a result setphp frontbase 函数 returns the error number from previous operationphp maxdb 函数 returns the number of warnings from the last query for the given linkphp mssql 函数 returns the number of records affected by the queryphp mysqlnd qc 函数 returns a list of available storage handlerphp 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 yaz 函数 returns error numberphp mysqli stmt returns the total number of rows changed deleted or inserted by the last executed statementphp mysqli returns the number of columns for the most recent queryphp solrquery returns the maximum number of highlighted snippets to generate per fieldphp splobjectstorage adds all objects from another storagephp splobjectstorage checks if the storage contains a specific objectphp splobjectstorage returns the number of objects in the storagephp splobjectstorage returns the current storage entryphp 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 storagephp splobjectstorage unserializes a storage from its string representationphp sqlite3stmt returns the number of parameters within the prepared statement
关注编程学问公众号