PHP | Ds\Vector merge()函数
Ds\Vector::merge()函数是PHP中的一个内置函数,用于将所有元素合并到向量中。
句法:
Ds\Vector public Ds\Vector::merge( $values )
参数:此函数接受单个参数$values ,它是可遍历的对象或数组。
返回值:该函数返回将元素合并到向量后的向量副本。
下面的程序说明了PHP中的Ds\Vector::merge()函数:
方案一:
PHP
merge($arr2));
?>
PHP
merge($arr2));
?>
输出:
Original vector elements
Ds\Vector Object
(
[0] => 10
[1] => 20
[2] => 30
[3] => 40
[4] => 50
)
Vector Elements after merging
Ds\Vector Object
(
[0] => 10
[1] => 20
[2] => 30
[3] => 40
[4] => 50
[5] => 60
[6] => 70
[7] => 80
[8] => 90
[9] => 100
)
方案二:
PHP
merge($arr2));
?>
输出:
Original vector elements
Ds\Vector Object
(
[0] => geeks
[1] => for
[2] => geeks
)
Vector Elements after merging
Ds\Vector Object
(
[0] => geeks
[1] => for
[2] => geeks
[3] => 60
[4] => 70
[5] => 100
)
参考: http: PHP。 PHP