If you want to store your data in the object form then the use the SplObjectStorage
. The SplQueue will overkill for small array.
SplQueue works on FIFO.
So you cann't access directly to last or near to the last and will take time.
Instead of SplQueue
I will suggest you use the Array as you can access any element directly by array index.
You can also check the answer of this question: Associative Array versus SplObjectStorage
Also you can check the the performance of SPLobjectStorage and array, here is the code.
For more read here.
SplObjectStorage definitely scaled linearly. Array performance was less predictable (larger standard deviation) with smaller data sets. And SplObjectStorage is indeed a better solution for storing lots of objects in a set.
So if your data is small then you should use the array otherwise use the SplObjectStorage
for large amount of data.