PHP Ds Deque construct() 函数
Ds\Deque::__construct() 函数可以创建一个新实例。
语法
public Ds\Deque::__construct([ mixed $values ] )
Ds\Deque::__construct()方法可以通过使用遍历对象或者数组来创建一个新的实例,用于初始化值。
示例1
<?php
deque = new \Ds\Deque(); echo("The elements of first deque: \n"); var_dump(deque);
deque = new \Ds\Deque([10, 20, 30, 40, 50]); echo("\n The elements of second deque: \n"); var_dump(deque);
?>
示例2
<?php
deque = new \Ds\Deque(["Tutorials", "Point", "Tutorix"]); echo("The elements of first deque: \n"); print_r(deque);
deque = new \Ds\Deque(["I", "N", "D", "I", "A", 1, 2, 3]); echo("\n The elements of second deque: \n"); print_r(deque);
?>