Ds\Collection::copy() 函數可以返回集合的淺拷貝。
用法
abstract public Ds\Collection Ds\Collection::copy( void )
Ds\Collection::copy() 函數可以不帶任何參數。
Ds\Collection::copy() 函數可以返回集合的淺拷貝。
示例1
<?php
$collection = new \Ds\Vector([10, 15, 20, 25, 30, 35]);
print_r($collection);
$collection->copy();
print_r($collection);
?>
示例2
<?php
$collection = new \Ds\Vector([10, 15, 20, 25, 30, 35]);
print_r($collection);
$collection->copy();
$collection->pop();
print_r($collection);
?>
相關用法
- PHP Ds\Collection::clear()用法及代碼示例
- PHP Ds\Collection::isEmpty()用法及代碼示例
- PHP Ds\Collection::toArray()用法及代碼示例
- PHP Ds\Collection copy()用法及代碼示例
- PHP Ds\Collection clear()用法及代碼示例
- PHP Ds\Collection isEmpty()用法及代碼示例
- PHP Ds\Collection toArray()用法及代碼示例
- PHP Ds\Queue::push()用法及代碼示例
- PHP Ds\Sequence remove()用法及代碼示例
- PHP Ds\Vector unshift()用法及代碼示例
- PHP Ds\Vector last()用法及代碼示例
- PHP Ds\Map putAll()用法及代碼示例
- PHP Ds\PriorityQueue pop()用法及代碼示例
- PHP Ds\Map slice()用法及代碼示例
- PHP Ds\Vector merge()用法及代碼示例
- PHP Ds\Set capacity()用法及代碼示例
- PHP Ds\Queue pop()用法及代碼示例
- PHP Ds\Set __construct()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - Ds\Collection::copy()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。