Ds\Collection::clear
(PECL ds >= 1.0.0)
Ds\Collection::clear — Removes all values
說明
abstract public Ds\Collection::clear(): void
Removes all values from the collection.
參數
此函式沒有參數。
返回值
沒有返回值。
範例
示例 #1 Ds\Collection::clear() example
<?php
$collection = new \Ds\Vector([1, 2, 3]);
print_r($collection);
$collection->clear();
print_r($collection);
?>
以上例程的輸出類似於:
Ds\Vector Object
(
[0] => 1
[1] => 2
[2] => 3
)
Ds\Vector Object
(
)