• PHP Video Tutorials

PHP - Ds\Collection::copy()



Ds\Collection::copy() function can return a shallow copy of the collection.

Syntax

abstract public Ds\Collection Ds\Collection::copy( void )

Ds\Collection::copy() function can doesn't have any parameters.

Ds\Collection::copy() function can return a shallow copy of the collection.

Example-1

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

Example-2

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