https://github.com/adrianosferreira/data-structures
A set of data structures implemented in PHP
https://github.com/adrianosferreira/data-structures
data-structures hash-table php
Last synced: 5 months ago
JSON representation
A set of data structures implemented in PHP
- Host: GitHub
- URL: https://github.com/adrianosferreira/data-structures
- Owner: adrianosferreira
- Created: 2020-01-24T17:19:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-24T19:20:11.000Z (about 6 years ago)
- Last Synced: 2024-12-28T04:13:59.422Z (over 1 year ago)
- Topics: data-structures, hash-table, php
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Data Structures Library for PHP
[](https://travis-ci.org/adrianosferreira/data-structures)
[](https://codecov.io/gh/adrianosferreira/data-structures)
[](https://packagist.org/packages/adrianoferreira/data-structures)
[](https://packagist.org/packages/adrianoferreira/data-structures)
A set of data structures implemented in PHP:
- Hash Table
- More soon...
## Installation
It's recommended that you use Composer to install this library.
```
$ composer require adrianoferreira/data-structures:dev-master
```
## Usage
```php
$hashTable = new \AdrianoFerreira\DS\HashTable\Table( 10 );
$hashTable->insert( 'my-key', 'my value' );
$hashTable->insert( 'my-key', 'updated value' );
$hashTable->insert( 'other-key', 'other value' );
$hashTable->insert( 'abc', 'abc value' );
$hashTable->insert( 'cba', 'cba value' );
//Outputs 'updated value' as it replaces the value of buckets with same key
echo $hashTable->get('my-key');
//Outputs 'other value'
echo $hashTable->get('other-key');
//Outputs 'cba value'
echo $hashTable->get('cba');
```