array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'ds-queue.copy.php', 1 => 'Ds\\Queue::copy', ), 'up' => array ( 0 => 'class.ds-queue.php', 1 => 'Ds\\Queue', ), 'prev' => array ( 0 => 'ds-queue.construct.php', 1 => 'Ds\\Queue::__construct', ), 'next' => array ( 0 => 'ds-queue.count.php', 1 => 'Ds\\Queue::count', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/queue/copy.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ds >= 1.0.0)
Ds\Queue::copy — Returns a shallow copy of the queue
Esta función no tiene parámetros.
Returns a shallow copy of the queue.
Ejemplo #1 Ds\Queue::copy() example
<?php
$a = new \Ds\Queue([1, 2, 3]);
$b = $a->copy();
// Updating the copy doesn't affect the original
$b->push(4);
print_r($a);
print_r($b);
?>
El resultado del ejemplo sería algo similar a:
Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 ) Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )