• PHP Video Tutorials

PHP - Ds Deque copy() Function



Ds\Deque::copy() function can return a shallow copy of the deque.

Syntax

public Ds\Deque Ds\Deque::copy( void )

Ds\Deque::copy() function doesn't have any parameters. This function can return a shallow copy of the deque.

Example

<?php
   $x = new \Ds\Deque([1, 2, 3]);
   $y = $x->copy();
   $y->push(4);
   
   print_r($x);
   print_r($y);
?>
php_function_reference.htm
Advertisements