SplQueue::__construct()函數是PHP中的內置函數, 用於構建使用雙鏈表實現的隊列。php
語法以下:html
void SplQueue::__construct(void)
參數:此函數不接受任何參數。後端
返回值:此函數不返回任何值。app
下面的程序說明了SplQueue::__ construct()PHP中的函數:函數
程序1:.net
<?php // Create a new empty queue $q = new SplQueue(); $q [] = 1; $q [] = 2; $q [] = 3; // Print the queue elements echo $q [0] . "n" ; echo $q [1] . "n" ; echo $q [2] . "n" ; ?>
輸出以下:code
1 2 3
程式2:htm
<?php // Create some fixed size array $gfg = new SplQueue(); $gfg [] = 1; $gfg [] = 5; $gfg [] = 1; $gfg [] = 11; $gfg [] = 15; $gfg [] = 17; foreach ( $gfg as $elem ) { echo $elem . "n" ; } ?>
輸出以下:隊列
1 5 1 11 15 17
參考: https://www.php.net/manual/en...後端開發
更多後端開發相關內容請參考:lsbin - IT開發技術:https://www.lsbin.com/
查看如下更多PHP相關的內容: