SplQueue::__construct()函数是PHP中的内置函数, 用于构建应用双链表实现的队列。
语法如下:
void SplQueue::__construct(void)
参数:此函数不承受任何参数。
返回值:此函数不返回任何值。
上面的程序阐明了SplQueue::__ construct()PHP中的函数:
程序1:
<?php // Create a new empty queue$q = new SplQueue(); $q [] = 1;$q [] = 2;$q [] = 3; // Print the queue elementsecho $q [0] . "n" ;echo $q [1] . "n" ;echo $q [2] . "n" ;?>
输入如下:
123
程式2:
<?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" ;}?>
输入如下:
151111517
参考: https://www.php.net/manual/en...
更多后端开发相干内容请参考:lsbin - IT开发技术:https://www.lsbin.com/
查看以下更多PHP相干的内容:
- PHP DsDeque Capacity()函数用法:https://www.lsbin.com/3677.html
- PHP错误处理办法:https://www.lsbin.com/3671.html
- PHP DsSequence apply()函数用法:https://www.lsbin.com/3539.html