Re: [PHP-DEV] toString() and Object #ID

2007-07-01 Thread Pavel Shevaev
On 6/30/07, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > always helpful). Is there any other way than casting an object to a > string to get an objects #ID? spl_object_hash? Guys, excuse my being a little offtopic here, but why not introduce standard "get_object_id" function in PHP6 which c

Re: [PHP-DEV] toString() and Object #ID

2007-07-01 Thread Pavel Shevaev
SPL is "in the core" AFAIAC. I really want to hope it will be in PHP6. Still IMHO get_object_id sounds much better than spl_object_hash and it will be much easier(and more logical) to locate this function in "Class/Object Functions" section of documentation than in SPL... -- Best regards, Pav

Re: [PHP-DEV] toString() and Object #ID

2007-07-01 Thread 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 c

Re: [PHP-DEV] toString() and Object #ID

2007-07-01 Thread Pavel Shevaev
The problem is that there is no such unique id in the current engine. 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. -- Best regards, Pavel -- PHP Internals - PHP Runti

Re: [PHP-DEV] toString() and Object #ID

2007-07-02 Thread Pavel Shevaev
Guys thank you all very much for this detailed explanation! spl_object_hash is unique in the terms of object identity. I really don't want to be annoying but from the end user's POV spl_object_hash sounds like a function which returns a hash but not an identity. Any tiny chance it will be ava

Re: [PHP-DEV] toString() and Object #ID

2007-07-02 Thread Pavel Shevaev
Hmm. I think what Pavel is asking is just to make it clearer in the documentation what spl_object_hash's purpose and workings are, and perhaps make an alias to it named object_get_id so other people don't run into this confusion in the future. The name of spl_object_hash and the fact it is in the

Re: [PHP-DEV] toString() and Object #ID

2007-07-04 Thread Pavel Shevaev
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

Re: [PHP-DEV] toString() and Object #ID

2007-07-04 Thread Pavel Shevaev
The first is cleared before the second is instantiated. Oh, that clears everything, please ignore my previous post. Still, don't you think this is a bit misleading? IMHO, new object should always have the unique id(or hash in terms of spl)... -- Best regards, Pavel -- PHP Internals - PHP Runti

[PHP-DEV] The fastest way to save/restore PHP application state

2010-11-14 Thread Pavel Shevaev
Hi folks, Could you please recommend the fastest way to save/restore a state of a PHP application? Looks like the igbinary extension is a possible way to go. Are there any faster, possibly even more low level ways? For example, in C/C++ it's possible to save/restore POD structs as binary data ver