HH\Pair::at

Returns the value at the specified key in the current Pair

public function at(
  int $key,
): mixed;

If the key is not present, an exception is thrown. This essentially means if you specify a key other than 0 or 1, you will get an exception. If you don't want an exception to be thrown, use get() instead.

$v = $p->at($k)" is semantically equivalent to $v = $p[$k].

Parameters

  • int $key - the key from which to retrieve the value.

Return Values

  • mixed - The value at the specified key; or an exception if the key does not exist.