PHP's arrays are complex beasts; they allow rapid lookups like an ordinary hash table, but their key-value pairs are also ordered. How does the time cost of inserting an element into this structure change as the number of existing elements grows?
Does the time complexity depend upon exactly how I'm inserting the element into the array? For instance, do each of these operations:
array_unshift($array, $value);
array_push($array, $value);
array['some_new_key'] = $value;
have the same time complexity, or different time complexities?