php 双向行列

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-06-13 11:52:02
オリジナル
912 人が閲覧しました

php 双向队列

<?php class deque{	public $queue  = array();	public $length = 0;   	public function frontAdd($node){		array_unshift($this->queue,$node);		$this->countqueue();	}	public function frontRemove(){		$node = array_shift($this->queue);		$this->countqueue();		return $node;	}	  	public function rearAdd($node){		array_push($this->queue,$node);		$this->countqueue();	}	 	public function rearRemove(){		$node = array_pop($this->queue);		$this->countqueue();		return $node;	}	 	public function countqueue(){		$this->length = count($this->queue);    	}}$fruit = new deque();echo $fruit -> length;$fruit -> frontAdd("Apple");$fruit -> rearAdd("Watermelon");echo '<pre class="brush:php;toolbar:false">';print_r($fruit);echo '
ログイン後にコピー
';?>

?

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
PHP クラスの $this
から 1970-01-01 08:00:00
0
0
0
静的関数は $this を使用できません
から 1970-01-01 08:00:00
0
0
0
$this に関する小さな質問
から 1970-01-01 08:00:00
0
0
0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート