Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1683 invoked by uid 1010); 1 Jul 2007 21:41:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1668 invoked from network); 1 Jul 2007 21:41:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2007 21:41:02 -0000 Authentication-Results: pb1.pair.com header.from=planetbeing@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=planetbeing@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.204.234 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: planetbeing@gmail.com X-Host-Fingerprint: 72.14.204.234 qb-out-0506.google.com Received: from [72.14.204.234] ([72.14.204.234:25264] helo=qb-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/4D-32240-E6F18864 for ; Sun, 01 Jul 2007 17:41:02 -0400 Received: by qb-out-0506.google.com with SMTP id e11so1990406qbe for ; Sun, 01 Jul 2007 14:41:00 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:to:cc:references:in-reply-to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language; b=UMs21Zi98+ETO5OJqCN00ABLOrQlAZIvGnnYEszRKh5V4q+jnL+kKyc/ozl5sg4OWkV9jHQRJsVGe7iiSxUvpIAliLE/HzegMgyw+RbIAwHLK/g1a5aaya47fyroK3oD4uT+PNQhcnlnOT3krh78fiYR8Ye/Qs5V0rPd8MwoS4s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:to:cc:references:in-reply-to:subject:date:message-id:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language; b=XOZUpZ5/YONKMuqDPKMkgZJ7xOUwxDfJNuJfmKZFffOENbcBfxcdjCqoTvb40oyAxUG594qIIaTSS9du8BGPgmrnKl07ymY6lYo2BNE8IRvUoBo2ZE+Dwha7eUJ3xfXyGGTPxM6iAWJKdj//cwGzUmaBGdPM6BiV3J3J1Z0JLPA= Received: by 10.141.171.6 with SMTP id y6mr1270503rvo.1183326059591; Sun, 01 Jul 2007 14:40:59 -0700 (PDT) Received: from DavidPC ( [24.21.139.96]) by mx.google.com with ESMTP id b34sm18192233rvf.2007.07.01.14.40.58 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Jul 2007 14:40:58 -0700 (PDT) To: "'Pavel Shevaev'" , "'Sebastian Bergmann'" Cc: References: <468519DC.8060502@widescreen.ch> <4685785E.5010709@zend.com> <585221804.20070701154538@marcus-boerger.de> In-Reply-To: Date: Sun, 1 Jul 2007 14:40:56 -0700 Message-ID: <002701c7bc28$8279c2c0$876d4840$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ace8HvZDEPYKeJ/rSNG32ICQrp1ZTQACYBAA Content-Language: en-us Subject: RE: [PHP-DEV] toString() and Object #ID From: planetbeing@gmail.com ("David") (accidentally didn't send this to the whole group at first) > Am I right in my guess that there's only a counter for each object > type? Still being not really unique this information could be very > useful and enough in many situations. The "counter" is global, but it's not really a counter. "Object ids" are actually handles (basically indices) into an internal array holding data to all objects currently in memory. Handles are reused when an object is destroyed so that the array could be kept as small as possible. However, if you are comparing the handles of two objects that are known to be currently in memory, if they have the same handle, then they are the same object (i.e. one spot in memory). However, if you stored the handle of the object in another area of memory so that you can check it against other objects later, it's hard to ensure that the results of that comparison is meaningful. Therefore, it's better to use spl_object_hash to actually ensure objects are the same. Internally, the hash is performed on the object handle (what you've been calling the "object id") as well as the internal list of handlers for that object (basically the "type" of the object), so there's reasonable confidence that a unique hash will be generated. It looks like it's independent of the actual properties, etc. of the object. Spl_object_hash is what you guys want. David