HH\Map::contains
Determines if the specified key is in the current Map
public function contains(
mixed $key,
): bool;
This function is interchangeable with containsKey()
.
Guide
Parameters
mixed $key
Returns
bool
-true
if the specified key is present in the currentMap
; returnsfalse
otherwise.
Examples
$m = Map {
'red' => '#ff0000',
'green' => '#00ff00',
'blue' => '#0000ff',
'yellow' => '#ffff00',
};
// Prints "true", since key "red" is the first key
\var_dump($m->containsKey('red'));
// Prints "true", since key "yellow" is the last key
\var_dump($m->containsKey('yellow'));
// Prints "false", since key "blurple" isn't in the Map
\var_dump($m->containsKey('blurple'));