> > 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). >
Yes, because the hashtable is an ordered map. The only way to logically prepend to it is to rework the whole thing. That's generally how you prepend to a stack as well. You'll probably find that in most C implementations of a stack or a linked list the only way to prepend is to rebuild the entire stack or list. That's why the existing implementation is just doing the equivalent of what I demonstrated in PHP code (it creates a new hashtable). Line 2053 of ext/standard/array.c HashTable *new_hash; /* New hashtable for the stack */ > > 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. > It's generally more costly to do so, yes. > > > 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! :-) > Cheers :) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php