HH\Set::count

Provides the number of elements in the current Set

public function count(): int;

Returns

  • int - The number of elements in the current Set.

Examples

$s = Set {};
var_dump($s->count());

$s = Set {'red', 'green', 'blue', 'yellow'};
var_dump($s->count());
Output
int(0)
int(4)