[lang-ref] ( dict_value_exists ) ( php )
<?php
public function testDictValueExists(): void
{
// in_array($v, $d)
$d = [ 'A' => 1, 'B' => 2, 'C' => 3 ];
$this->assertTrue(in_array(2, $d));
$this->assertFalse(in_array(4, $d));
}
<?php
public function testDictValueExistsAlternative(): void
{
// array_search($v, $d) !== false
$d = [ 'A' => 1, 'B' => 2, 'C' => 3 ];
$this->assertTrue(array_search(2, $d) !== false);
$this->assertFalse(array_search(4, $d) !== false);
}