php8.5
Home/ Manual/ ds / map/ Ds\Map::hasValue

Ds\Map::hasValue

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Determines whether the map contains a given value

Description

Ds\Map::hasValue(mixed $value): bool

Determines whether the map contains a given value.

Parameters

value

The value to look for.

Return Values

Returns true if the value could be found, false otherwise.

Examples

Ds\Map::hasValue() example

php
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);

var_dump($map->hasValue(1)); // true
var_dump($map->hasValue(4)); // false
?>

The above example will output something similar to:

output
bool(true)
bool(false)

Source: reference/ds/ds/map/hasvalue.xml · from the official PHP manual (php/doc-en)