• PHP Video Tutorials

PHP - Ds\Collection::toArray()



Ds\Collection::toArray() function can convert the collection to an array.

Syntax

abstract public array Ds\Collection::toArray( void )

Ds\Collection::toArray() function doesn't have any parameters and can return an array containing all values in the same order as a collection.

Example-1

<?php  
   $collection = new \Ds\Vector([10, 15, 20, 25, 30, 35]); 
   var_dump($collection->toArray());
?> 

Example-2

<?php  
   $collection = new \Ds\Vector([10, 15, 20, 25, 30, 35]); 
  
   print_r($collection); 
   print_r($collection->toArray());
?>
php_function_reference.htm
Advertisements