HH\Set::firstValue

Returns the first value in the current Set

public function firstValue(): ?Tv;

Returns

  • ?Tv - The first value in the current Set, or null if the Set is empty.

Examples

The following example gets the first value from a Set. An empty Set will return null as its first value.

$s = Set {'red', 'green', 'blue', 'yellow'};
\var_dump($s->firstValue());

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