It is because when putting the key value in array using string (first, second, ...). it is because you trying to remove (unset) the map by using the value from the items. Since you insert map using (first, second, ...), when the capacity is full, you array pop from the items, which is it save the value (1,2,..) so when unsetting the map, it is not work. cause the map[1] it is not found. cause it save the map[first, second]
very nice and informative. I really miss such topics with php implementation
Thank you very much! More topics such as this coming.
Btw the test return FAILURE
```php
1) Tests\LRUCache\LRUCacheArrayTest::it_should_keep_elements_in_the_right_order
Failed asserting that 2 is null.
```
It is because when putting the key value in array using string (first, second, ...). it is because you trying to remove (unset) the map by using the value from the items. Since you insert map using (first, second, ...), when the capacity is full, you array pop from the items, which is it save the value (1,2,..) so when unsetting the map, it is not work. cause the map[1] it is not found. cause it save the map[first, second]
hmm it's all green to me. However, I did not push the last changes. I did it now. Is it still red?
Ah, I miss something in the code. nevermind
in the put function, I put $value to unshift, array_unshift($this->items, `$value`);
but after clone and check your repository, it is $key to unshift array_unshift($this->items, `$key`);
Ya, I am the one who do the mistakes. thank you