X Tutup
The Wayback Machine - https://web.archive.org/web/20201220225509/https://github.com/PHPSnippets/CircularArray
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Circular Array

Build Status Minimum PHP Version Release Coverage Status Quality Score Software License

Image: Cburnett

From Wikipedia:

A circular buffer, circular queue, cyclic buffer or ring buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. This structure lends itself easily to buffering data streams.

Install

Via Composer

$ composer require php-snippets/circular-array

Usage

You can create an array where an interaction occurs indefinitely:

use PHPSnippets\DataStructures\CircularArray;

$circular = Circular::fromArray(array(1, 2, 3, 4));

// this foreach never ends, after 4 back to 1.
foreach($circular as $value){
    echo $value;
}

Requirements

The following versions of PHP are supported by this version.

  • PHP >= 5.3

Testing

$ vendor/bin/phpunit

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

MIT. Please see License File for more information.

You can’t perform that action at this time.
X Tutup