vbpupil / queue
A simple Queue data structure.
2.0.0
2022-09-06 18:52 UTC
Requires (Dev)
- phpunit/phpunit: 9.3.3
This package is auto-updated.
Last update: 2025-03-07 01:08:42 UTC
README
Queue Data Structure
A simple Queue data structure mechanism which allows you to set a max limit of items you wish to hold. After the max amount is met any subsequent additions will knock off items from the end.
Sample Usage
include 'vendor/autoload.php'; use vbpupil\Queue\Queue; // create a new queue and specify a limit - here we have set it to hold 1 item. $q = new Queue(1); //add items $q->addItem('Item 1') ->addItem('Item 2') ->addItem('Item 3') ->addItem('Item 4') ->addItem('Item 5'); echo($q->getItems());
The above example will return 1 item with the value of Item 5.