note 110242 deleted from function.spl-object-hash by googleguy
| From: | googleguy@php.net | Date: | Mon, 08 Oct 2012 04:12:48 +0000 |
| Subject: | note 110242 deleted from function.spl-object-hash by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191180@lists.php.net to get a copy of this message | ||
Note Submitter: sergei dot solomonov at gmail dot com
----
Changing the state of an object does not affect the result
<?php
class Foo {
public $bar;
}
$foo_obj = new Foo;
var_dump(spl_object_hash($foo_obj));
// changing the state of an object
$foo_obj->bar = 'some value';
var_dump(spl_object_hash($foo_obj));
// same class, but another object
$foo_obj2 = new Foo;
$foo_obj2->bar = 'some value2';
var_dump(spl_object_hash($foo_obj));
?>
This will output something like:
string(32) "000000007f6499d0000000006ac34943"
string(32) "000000007f6499d0000000006ac34943"
string(32) "000000007f6499d0000000006ac34943"