HH\Set::toValuesArray

Returns an array containing the values from the current Set

public function toValuesArray(): varray<Tv>;

This method is interchangeable with toKeysArray().

Returns

  • varray<Tv> - an integer-indexed array containing the values from the current Set.

Examples

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

$array = $s->toValuesArray();

var_dump(is_array($array));
var_dump($array);
Output
bool(true)
array(4) {
  [0]=>
  string(3) "red"
  [1]=>
  string(5) "green"
  [2]=>
  string(4) "blue"
  [3]=>
  string(6) "yellow"
}