PHP code example of lamansky / map
1. Go to this page and download the library: Download lamansky/map library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lamansky / map example snippets
use Lamansky\Map\Map;
$map = new Map();
// Set
$map->set('key', 'value');
// Has
var_dump($map->has('key')); // bool(true)
// Get
echo $map->get('key'); // 'value'
// Keys & Values
print_r($map->keys()); // Array ( [0] => key )
print_r($map->values()); // Array ( [0] => value )
// Iteration
foreach ($map as $key => $value) {
}
// Count
var_dump($map->count()); // int(1)
// Delete
var_dump($map->delete('key')); // bool(true) // found
var_dump($map->delete('key')); // bool(false) // not found