Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62680 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17966 invoked from network); 2 Sep 2012 19:31:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2012 19:31:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=amaury.bouchard@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=amaury.bouchard@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: amaury.bouchard@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:48497] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/64-17065-FF3B3405 for ; Sun, 02 Sep 2012 15:31:11 -0400 Received: by obbwc18 with SMTP id wc18so8900912obb.29 for ; Sun, 02 Sep 2012 12:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=lHpWI2bwlETOngoLFapc9uvlc8vr9SieDWS2eTfmXro=; b=bGTaraAp0kbu0JOYny/KUNPDhIVbzLdZh5kVO/mP//b0IeDlqkzsskI9UxuPJAlknk xX8Q5p1KumVpUw8i9fxL22dXpMSWxyUJFYWPzcW3ZSuhwfF5UqraQbLG+IVd2FL+LShj mTU9VVP+ls32uA7IXfNA+pveOKbYtEmtExIO6QFTl2eowz+Ps0z8EiPCZUxe/0wSo7vH aIhdPkKgtI/M/+1LMIzu3HUkanIoukLfZmjkvtGa9kFsC1QZQgujWnzXAkjpbe7Z4+Fv A145rzs/8OmGB1wLYH/ikSd1+ygzXr9uT8G1TyuOD+RBv94OwCcovDCG1nDCr1hIAsRv bDew== Received: by 10.60.12.8 with SMTP id u8mr12485440oeb.46.1346614268321; Sun, 02 Sep 2012 12:31:08 -0700 (PDT) MIME-Version: 1.0 Sender: amaury.bouchard@gmail.com Received: by 10.182.193.68 with HTTP; Sun, 2 Sep 2012 12:30:47 -0700 (PDT) In-Reply-To: References: Date: Sun, 2 Sep 2012 21:30:47 +0200 X-Google-Sender-Auth: Knp_ZJgg5tWdm630cPXaAgTpajg Message-ID: To: Sherif Ramadan Cc: PHP Internals Content-Type: multipart/alternative; boundary=e89a8fb1ef561ce14804c8bd1156 Subject: Re: [PHP-DEV] Question about hashtables implementation From: amaury@amaury.net (Amaury Bouchard) --e89a8fb1ef561ce14804c8bd1156 Content-Type: text/plain; charset=ISO-8859-1 2012/9/2 Sherif Ramadan > 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! :-) --e89a8fb1ef561ce14804c8bd1156--