PHP - Ds \ Collection :: toArray ()

La fonction Ds \ Collection :: toArray () peut convertir la collection en tableau.

Syntaxe

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

La fonction Ds \ Collection :: toArray () n'a aucun paramètre et peut renvoyer un tableau contenant toutes les valeurs dans le même ordre qu'une collection.

Exemple 1

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

Exemple-2

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