A queue is a linear table that is based on the FIFO principle:
PHP Implementation queue: First element as Team head, last element as team tail
What is a double-ended queue (or two-way queue) Deque, full name double-ended queue?
That is, the elements can be queued or out of the queue in any part of the queues, if we call these methods Insertleft () and Insertright (), and Removeleft () and Removeright (). If you strictly prohibit calling the Insertleft () and Removeleft () methods (or disabling the right segment), the dual-ended queue function is the same as the stack. Calling Insertleft () and Removeright () (or the opposite of another method) is forbidden, and it functions like a queue. A dual-ended queue is a multi-purpose data structure compared to a stack or queue.
PHP implements a dual-ended queue:
PHP enables the use of a dual-ended queue queue:
Queues are a good way to handle data transfer and storage asynchronously, and when you frequently insert data into a database, and frequently submit data to a search engine, you can take a queue to insert asynchronously. In addition, the slow processing logic, the processing logic with concurrent quantity limit, can be processed in the background through message queue, such as FLV video conversion, sending SMS, sending e-mail, etc.
Text Address: PHP implementation Queue and queue principle
PHP implementation Queue and queue principle