FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Correlating curl resources to some other object.
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Correlating curl resources to some other object. [message #185099] Wed, 26 February 2014 16:54 Go to previous message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma:
Member
I may have up to a few dozen curl handles (from curl_init()), which I'm
passing off to curl_multi etc... to make in parallel. As requests
finish, I'm using curl_multi_info_read to figure out which curl handle
completed. I have other objects which have additional information about
the curl handles which I need in order to process them.

I'm disappointed to see there isn't an equivalent to spl_object_hash for
resources.

In any case, it looks like casting a resource to a string results in a
unique identifier [1], but the manual also states that the structure is
"subject to change". I interpret that as it will still be unique (at
least for that resource type), but it may be in a different format.

So, I'm wondering if using the (string) cast of a Resource as an array
key is going to lead to unexpected bugs during some future PHP upgrade.
I'd rather not loop through all my objects to find the matching one.
It's a small enough set that I might do that if there isn't another
reliable way to achieve this, but I'd rather have an O(1) solution.


Thanks,
Daniel.


References:
[1]
< http://us3.php.net/manual/en/language.types.string.php#language.types.strin g.casting>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Why is polymorphism in PHP not like other languages? Is there a bug in PHP?
Next Topic: Operator precedence
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 21:45:18 GMT 2024

Total time taken to generate the page: 0.04596 seconds