HH\Set::toVector

Returns a Vector of the current Set values

Description

public function toVector(): Vector<Tv>;

Return Values

  • Vector<Tv> - a Vector (integer-indexed) that contains the values of the current Set.

Examples

<?hh

namespace Hack\UserDocumentation\API\Examples\Set\ToVector;

$s = Set {'red', 'green', 'blue', 'yellow'};

$v = $s->toVector();

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