Re: toString() and Object #ID

From: Date: Wed, 04 Jul 2007 12:22:17 +0000
Subject: Re: toString() and Object #ID
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-30437@lists.php.net to get a copy of this message
Not quite. It creates a hash of an object, so two objects with the same data yield the same hashes: var_dump(spl_object_hash(new stdClass()), spl_object_hash(new stdClass ()));
Folks, is this really wanted behavior? Because if so, why does the following result in the same hash as well(PHP-5.2.1)? $ php -r "class Foo{};$foo = new Foo();var_dump(spl_object_hash($foo));$foo->bar = 1;var_dump(spl_object_hash($foo));" string(32) "d1f40a1cc04d8c79d09ae6262666adbb" string(32) "d1f40a1cc04d8c79d09ae6262666adbb"
- David
-- Best regards, Pavel

« previous php.internals (#30437) next »