Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8472 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41837 invoked by uid 1010); 10 Mar 2004 15:24:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 41699 invoked from network); 10 Mar 2004 15:24:00 -0000 Received: from unknown (HELO blobule.suds) (66.11.170.154) by pb1.pair.com with SMTP; 10 Mar 2004 15:24:00 -0000 Received: by blobule.suds (Postfix, from userid 501) id 1259F2F717; Wed, 10 Mar 2004 10:24:01 -0500 (EST) To: internals@lists.php.net Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8-3mdk Date: 10 Mar 2004 10:24:00 -0500 Message-ID: <1078932240.5573.132.camel@blobule.suds> Mime-Version: 1.0 Subject: Question about internal workings of references/variables. From: robert@interjinn.com (Robert Cummings) Hi Internals, I'd like to confirm/refute some knowledge I think I have of the PHP internal workings with respect to variables and references. I believe that when a variable is assigned the value of another variable an internal reference is created and some bit is used to keep track of whether the value should be copied when an attempt is made to change either the original variable or the newly assigned variable (maybe this isn't the case for integers or floats since the performance would be similar). Can anyone confirm or elaborate further? Also I think I remember hearing once upon a time that creating a reference in PHP script is more work than creating a copy when the copy won't be altered? Can this be confirmed also? Last but not least, do objects work under the same principles? I did some benchmarking and my first question seems to hold since assigning by value a 100000 entry array 10 million times runs as fast as assigning a single integer 10 million times. The second doesn't seem to hold true since the execution time is slightly (but significantly and consistently) faster. Thanks for any information. Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'