pht\HashTable::size

(PECL pht >= 0.0.1)

pht\HashTable::sizeGets the size of the hash table

Description

public pht\HashTable::size ( void ) : int

Returns the current size of the hash table. This operation requires a pht\HashTable's mutex lock to be held if it is being used by multiple threads.

Parameters

This function has no parameters.

Return Values

The size of the hash table.

Examples

Example #1 Getting a hash table's size

<?php

use pht\HashTable;

$hashTable = new HashTable();

$hashTable['a'] = 1;
$hashTable['b'] = 2;

var_dump($hashTable->size());

The above example will output:

int(2)