class DEQueue { //存储 protected $_storage = array(); //入头 public function unshift($element) { return array_unshift($this->_storage, $element); } //入尾 public function push($element) { return array_push($this->_storage, $element); } //出尾 public function pop() { return array_pop($this->_storage); } //出头 public function shift() { return array_shift($this->_storage); } //长度 public function length() { return count($this->_storage); } }
时间: 2024-10-20 14:12:32