array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ru', ), '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' => 'ru', '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 — Возвращает поверхностную копию очереди
У этой функции нет параметров.
Поверхностная копия очереди.
Пример #1 Пример использования Ds\Queue::copy()
<?php
$a = new \Ds\Queue([1, 2, 3]);
$b = $a->copy();
// Изменение копии не отражается на оригинале
$b->push(4);
print_r($a);
print_r($b);
?>
Вывод приведённого примера будет похож на:
Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 ) Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )