HH\Map::count

Provides the number of elements in the current Map

public function count(): int;

Returns

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

Examples

$m = Map {};
var_dump($m->count());

$m = Map {
  'red' => '#ff0000',
  'green' => '#00ff00',
  'blue' => '#0000ff',
  'yellow' => '#ffff00',
};
var_dump($m->count());
Output
int(0)
int(4)