Re: Invokation on __toString() for object used as array key
| From: | Michael Wallner | Date: | Wed, 24 Sep 2014 08:19:36 +0000 |
| Subject: | Re: Invokation on __toString() for object used as array key | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77572@lists.php.net to get a copy of this message | ||
On 24/09/14 08:30, Stas Malyshev wrote:
> Hi!
>
>> Well, then let's remove this restriction from resources, too.
>
> Not sure what use would it be for resources - resource IDs are not
> controlled by user code and for all intents and purposes are opaque
> numbers, which also do not have to be unique over the life of the
> script. What use would it be to index by those, especially by implicit
> convert? I don't think right now we have implicit convert of resources
> to ints anywhere, like we do have with __toString.
>
There's currently no way to associate any data with a resource, except
by its ID.
$context[(int) $resource] = ...;
IIRC resources *were* implicitely converted to integers up until a
specific version, I'll have to look that up in history, though.
--
Regards,
Mike