Ds\Vector::copy() 函数可以返回向量的浅拷贝。
用法
public Ds\Vector Ds\Vector::copy( void )
Ds\Vector::copy() 函数没有任何参数。此函数可以返回向量的浅拷贝。
例子1
<?php
$array1 = new \Ds\Vector([1, 2, 3, 5]);
$array2 = $arr1->copy();
echo("The original array is:\n");
print_r($array1);
echo("The copied array is:\n");
print_r($array2);
?>
例子2
<?php
$array1 = new \Ds\Vector(["Tutorials", "Point", "Tutorix"]);
$array2 = $array1->copy();
echo("The original array is:\n");
print_r($array1);
echo("The copied array is:\n");
print_r($array2);
?>
相关用法
- PHP Ds Vector count()用法及代码示例
- PHP Ds Vector construct()用法及代码示例
- PHP Ds Vector contains()用法及代码示例
- PHP Ds Vector capacity()用法及代码示例
- PHP Ds Vector clear()用法及代码示例
- PHP Ds Vector allocate()用法及代码示例
- PHP Ds Vector get()用法及代码示例
- PHP Ds Vector sum()用法及代码示例
- PHP Ds Vector sorted()用法及代码示例
- PHP Ds Vector set()用法及代码示例
- PHP Ds Vector unshift()用法及代码示例
- PHP Ds Vector rotate()用法及代码示例
- PHP Ds Vector last()用法及代码示例
- PHP Ds Vector push()用法及代码示例
- PHP Ds Vector first()用法及代码示例
- PHP Ds Vector jsonSerialize()用法及代码示例
- PHP Ds Vector insert()用法及代码示例
- PHP Ds Vector toArray()用法及代码示例
- PHP Ds Vector merge()用法及代码示例
- PHP Ds Vector join()用法及代码示例
注:本文由纯净天空筛选整理自 PHP - Ds Vector copy() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。