首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Ds\Queue::copy

(PECL ds >= 1.0.0)

Ds \ Queue :: copy - 返回队列的浅表副本。

Description

代码语言:javascript
复制
public Ds\Queue Ds\Queue::copy ( void )

返回队列的浅表副本。

Parameters

该功能没有参数。

Return Values

返回队列的浅表副本。

Examples

Example #1 Ds\Queue::copy() example

代码语言:javascript
复制
<?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);
?>

上面的例子会输出类似于:

代码语言:javascript
复制
Ds\Queue Object
(
    [0] => 1
    [1] => 2
    [2] => 3
)
Ds\Queue Object
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
)

← Ds\Queue::__construct

Ds\Queue::count →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

根据知识共享署名许可证v3.0或更高版本授权。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com