HH\Vector::resize

Resize the current Vector

public function resize(
  int $sz,
  Tv $value,
): void;

Resize the current Vector to contain $sz elements. If $sz is smaller than the current size of the current Vector, elements are removed from the end of the current Vector. If $sz is greater than the current size of the current Vector, the current Vector is extended by appending as many copies of $value as needed to reach a size of $sz elements.

$value can be null.

If $sz is less than zero, an exception is thrown.

Parameters

  • int $sz - The desired size of the current Vector.
  • Tv $value - The value to use as the filler if we are increasing the size of the current Vector.