HH\Vector::clear

Removes all the elements from the current Vector.

Description

public function clear(): Vector<Tv>

Removes all the elements from the current Vector.

Future changes made to the current Vector ARE reflected in the returned Vector, and vice-versa.

Return Values

Examples

<?hh

namespace Hack\UserDocumentation\API\Examples\Vector\Clear;

$v = Vector {'red', 'green', 'blue', 'yellow'};
var_dump($v);

$v->clear();
var_dump($v);
Output
object(HH\Vector)#1 (4) {
  [0]=>
  string(3) "red"
  [1]=>
  string(5) "green"
  [2]=>
  string(4) "blue"
  [3]=>
  string(6) "yellow"
}
object(HH\Vector)#1 (0) {
}