2012/9/2 Sherif Ramadan <theanomaly...@gmail.com>

> To clarify, this particular functionality you're using as an example
> "array_unshift" really isn't specific to the internal implementation
> of hashtables in PHP. That is to say that this side-effect you're
> describing is specific to that function and not necessarily
> hashtables' internal implementation.
>

OK, thanks for the information. It explains why I didn't find anything in
the HashTable structure (unlike iterator pointer or the next free key).

Essentially, array_unshift() just rebuilds the array. From
> http://php.net/array-unshift "All numerical array keys will be
> modified to start counting from zero while literal keys won't be
> touched"
>

You're right; I hadn't noticed that.
Side effect: add values at the beginning of an array could be very
time-consuming, according to its size.

If you're interested in a more detailed explanation of the
> implementation of PHP's Array type you might find this article by
> Nikic useful:
> http://nikic.github.com/2012/03/28/Understanding-PHPs-internal-array-implementation.html


Thanks again for this link. I have the book of Sara (huge piece of work,
btw), and I found some good documentation. But more information wouldn't
hurt!   :-)

Reply via email to