37 $z =
new self(array(), array_reverse($array));
49 if (
$t !== NULL) $a[] =
$t;
50 for ($i = count($this->back)-1; $i >= 0; $i--) {
51 $a[] = $this->back[$i];
62 if (
$t !== NULL) array_push($this->front,
$t);
63 return empty($this->back) ? NULL : array_pop($this->back);
73 for ($i = 0; $i <
$n; $i++) {
85 if (
$t !== NULL) array_push($this->back,
$t);
86 return empty($this->front) ? NULL : array_pop($this->front);
94 public function delete() {
95 return empty($this->back) ? NULL : array_pop($this->back);
103 return empty($this->back);
111 if (
$t !== NULL) array_push($this->front,
$t);
119 if (
$t !== NULL) array_push($this->back,
$t);
142 public function splice(
$t, $delete, $replacement) {
146 for ($i = $delete; $i > 0; $i--) {
148 $r = $this->
delete();
151 for ($i = count($replacement)-1; $i >= 0; $i--) {
153 $r = $replacement[$i];
155 return array($old, $r);