Re: New function proposal: spl_object_id

From: Date: Sat, 24 Jan 2009 18:05:19 +0000
Subject: Re: New function proposal: spl_object_id
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-42815@lists.php.net to get a copy of this message
Hello Guilherme
The new implementation of spl_object_hash will solve it, since it's a faster implementation than the old one. Just one hint, you should not try to echo the generated hash, since it may have non-printable chars. I don't think that will be a problem...
Also, your code may still be possible to use SplObjectStorage. Etienne did a lot of research regarding how it could be used, and he showed me that a n-dimensional array is possible too. In your situation, $events should be an ArrayAccess instance, while each $events[$event] should be an SplObjectStorage. May I ask why your sample uses ArrayAccess instead of a plain array()? And ArrayAccess is an Interface, now I am bit puzzled.
SplObjectStorage will only allow objects (Docs?), I register static classes as event listener, so something like this won't work: EVENT::register("myevent", "Autoloader", "onmyevent"); // Register Autoloader::onmyevent() as event listener. A reason I wrote SplObjectStorage won't solve my usage of spl_object_hash. So don't mark spl_object_hash deprecated in 5.4 ;-) Best regards Oskar Eisemuth

« previous php.internals (#42815) next »