Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function make()
- {
- return $newVocabulary = [];
- }
- function set(&$map, $key, $value)
- {
- $hash = crc32($key) % 1000;
- if (array_key_exists($hash, $map)) {
- return false;
- }
- $map[$hash][1] = $value;
- return true;
- }
- function get(&$map, $key, $default = null)
- {
- $hash = crc32($key) % 1000;
- if (!array_key_exists($hash, $map)) {
- return 'null';
- }
- $heshResult = $map[$hash];
- $value = $heshResult[1];
- return $value === $default ? $value : 'null';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement