PHP Ds Deque set() 函数
Ds\Deque::set() 函数可以更新给定索引处的值。
语法
public void Ds\Deque::set( int index , mixedvalue )
Ds\Deque::set()函数没有返回任何值。如果索引无效,该函数可能会抛出OutOfRangeException。
示例1
<?php
deque = new \Ds\Deque([1, 2, 3, 4, 5]); echo("The elements in deque: \n"); print_r(deque);
deque->set(4, 10); echo("The deque after setting value at index 2: \n"); print_r(deque);
?>
示例2
<?php
deque = new \Ds\Deque(["Tutorials", "Point", "India", "Tutorix"]); echo("The elements of deque: \n"); print_r(deque);
deque->set(2, "tutorialspoint"); echo("The deque after setting value at index 2: \n"); print_r(deque);
?>