Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30388 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58676 invoked by uid 1010); 1 Jul 2007 19:18:24 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 58661 invoked from network); 1 Jul 2007 19:18:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jul 2007 19:18:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=pacha.shevaev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pacha.shevaev@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.146.177 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pacha.shevaev@gmail.com X-Host-Fingerprint: 209.85.146.177 wa-out-1112.google.com Received: from [209.85.146.177] ([209.85.146.177:19888] helo=wa-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/B8-32240-EFDF7864 for ; Sun, 01 Jul 2007 15:18:23 -0400 Received: by wa-out-1112.google.com with SMTP id l24so2006492waf for ; Sun, 01 Jul 2007 12:18:19 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Bl7dmKDPpx0UA6k2n6ff4QzoDuqOki0bNONyLdydPxZ79RepXYHF9pdI8ZgA9neS/OxNGSU25qypx660bhwjTMNeecCTWAFoLTICS4VYnR6GRWSZJKZYjOjP1yve83xty7ER6EqzbvBj4wrZS151/ZWuYCRN0Nl2UPPEpr6P/W8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Gkt5XB3/8TEQalZSMdAyXl2ha7Ftil7DGt9Rt2qw1AJFao19rZaEWCD3DxeVOCPfAk+PTnK9tLzHdg0cwcdFokR1yVkKkhxFHHs3YBPgZ/r+40DBD1BkLP7chmyoQN2q4h2FKhUfAYW1iqGTaTqfgbjQcmsGB2riYDgAbdKNIG4= Received: by 10.114.78.1 with SMTP id a1mr4440073wab.1183317499540; Sun, 01 Jul 2007 12:18:19 -0700 (PDT) Received: by 10.114.110.9 with HTTP; Sun, 1 Jul 2007 12:18:19 -0700 (PDT) Message-ID: Date: Sun, 1 Jul 2007 23:18:19 +0400 To: "Marcus Boerger" Cc: "Sebastian Bergmann" , internals@lists.php.net In-Reply-To: <585221804.20070701154538@marcus-boerger.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <468519DC.8060502@widescreen.ch> <4685785E.5010709@zend.com> <585221804.20070701154538@marcus-boerger.de> Subject: Re: [PHP-DEV] toString() and Object #ID From: pacha.shevaev@gmail.com ("Pavel Shevaev") > Again see mail archive for why. That said the name appears to be > the best option already. Oh, yes, you're right spl_object_hash does its job and does it very well, there's really no point rename it(or make an alias) into object_get_id. I should have stated more clear what I think object_get_id could actually be. How about object_get_id being a function returning the very first line of var_dump's output being applied to the object? Let me be a bit more specific, here's an example of var_dump usage: $ php -r "class Foo{};$foo = new Foo();var_dump($foo);" object(Foo)#1 (0) { } What I actually need, not the object hash but simply its unique id. And in this case "object(Foo)#1" would be just fine. How can I get it? The only way AFAIK is to surround var_dump with ob_start/ob_get_contents/ob_end_clean functions and extract this value. The problem with approach is if one has a complex object connected with a graph of other complex objects(with recursive links) var_dump may take a _very_ long time to complete. And this is what object_get_id could do - simply return object id prefixed with the class name. -- Best regards, Pavel