HH\Set::count

Provides the number of elements in the current Set

Description

public function count(): int

Return Values

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

Examples

<?hh

namespace Hack\UserDocumentation\API\Examples\Set\Count;

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

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