Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Use an Array as a Queue
How To Use an Array as a Queue? - PHP Script Tips - PHP Built-in Functions for Arrays
✍: FYIcenter.com
A queue is a simple data structure that manages data elements following the first-in-first-out rule. You use the following two functions together to use an array as a queue:
Here is a PHP script on how to use an array as a queue:
<?php $waitingList = array(); array_push($waitingList, "Jeo"); array_push($waitingList, "Leo"); array_push($waitingList, "Kim"); $next = array_shift($waitingList); array_push($waitingList, "Kia"); $next = array_shift($waitingList); array_push($waitingList, "Sam"); print("Current waiting list:\n"); print_r($waitingList); ?>
This script will print:
Current waiting list: Array ( [0] => Kim [1] => Kia [2] => Sam )
2007-04-21, 8211👍, 0💬
Popular Posts:
What will be printed as the result of the operation below: main() { int x=10, y=15; x = x++; y = ++y...
Does it matter in what order catch statements for FileNotFoundException and IOExceptipon are written...
What does a well-written Object Oriented program look like? A well-written object oriented program e...
Can Sub Procedure/Function Be Called Recursively? - Oracle DBA FAQ - Creating Your Own PL/SQL Proced...
What is the value of this expression? +1-2*3/4 -0.5