HH\Set::lastValue

Returns the last value in the current Set

public function lastValue(): ?Tv;

Returns

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

Examples

This example shows how lastValue() can be used even when a Set may be empty:

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

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