Re: get_class_vars() returned information ORDER
| From: | Sherif Ramadan | Date: | Sun, 09 Sep 2012 12:10:10 +0000 |
| Subject: | Re: get_class_vars() returned information ORDER | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62918@lists.php.net to get a copy of this message | ||
On Sun, Sep 9, 2012 at 7:52 AM, Johannes Schlüter
<johannes@schlueters.de> wrote:
>
>
> On Sep 9, 2012, at 10:22, Sherif Ramadan <theanomaly.is@gmail.com> wrote:
>>> I'm curious whether the ORDER of the class properties returned by
>>> get_class_vars(), is in some way guaranteed. I do not find mention of it
>>> in the documentation.
>>>
>>
>> The only real guarantee is that of how the class properties are stored
>> in the hashtable. get_class_vars() is essentially just reading from a
>> hashtable of class properties.
>
> There's no such guarantee. The fact that it is using a Hashtable which has an order is an
> implementation detail. This might change (even though a change is unlikely) The only promise of
> get_class_vars() is to return all.
>
Right, I should have said "there's no guarantee at all", but what I
was trying to say was that this isn't really by guarantee of
get_class_vars(). Just the fact that this particular implementation
detail is unlikely to change is what makes it a convenient side
effect.
Sorry, that was poorly worded.
> johannes
>