php8.5
Home/ Manual/ ds / vector/ Ds\Vector::toArray

Ds\Vector::toArray

PHP function Edit on GitHub ✎

(PECL ds >= 1.0.0)

Converts the vector to an Array

Description

Ds\Vector::toArray(): array

Converts the vector to an Array.

Note

Casting to an Array is not supported yet.

Parameters Parameters

Return Values

An Array containing all the values in the same order as the vector.

Examples

Ds\Vector::toArray() example

php
<?php
$vector = new \Ds\Vector([1, 2, 3]);

var_dump($vector->toArray());
?>

The above example will output something similar to:

output
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}

Source: reference/ds/ds/vector/toarray.xml · from the official PHP manual (php/doc-en)