I'm looking for most optimal way to store objects containing two properties, by which object could be looked up, in order. Easy way to insert new objects before and after specified key (one of property of the stored objects) is required too.
I am currently experimenting with SplDoublyLinkedList, which has a nice property of always being ordered and functionality of inserting nodes by index by add($index, $object);. DLL however requires looping through whole list to perform any lookup and additional loop to reset internal pointer to remembered position.
I was thinking about classic php array, but it needs ugly array_splice hacks to perform insertions (splitting array into keys and values, slicing both arrays in desired index, adding key and value into first keys and values arrays, merging resulting arrays and then combining keys with values) and keeping track of current position is less intuitive.
What would be my best bet?