HH\Vector::toArray

Returns an array containing the values from this Vector.

Description

public function toArray(): array<Tv>

Returns an array containing the values from this Vector.

This method is interchangeable with toValuesArray().

Return Values

Examples

<?hh

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

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

$array = $v->toArray();

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"
}