Re: Re: [RFC] [VOTE] Typed properties v2
| From: | Benjamin Morel | Date: | Wed, 06 Feb 2019 15:28:07 +0000 |
| Subject: | Re: Re: [RFC] [VOTE] Typed properties v2 | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104250@lists.php.net to get a copy of this message | ||
>
> We already have a function property_exists(). I don't know if it covers
> the case you want, though.
property_exists() returns whether the property is defined (as opposed to
initialized) in the given class / instance:
class A {
> private int $id;
> }
> $a = new A;
> var_export(property_exists($a, 'id')); // true
So this would require a new function.
On Wed, 6 Feb 2019 at 16:24, Rowan Collins <rowan.collins@gmail.com> wrote:
> On Wed, 6 Feb 2019 at 15:21, Benjamin Morel <benjamin.morel@gmail.com>
> wrote:
>
>> Thanks for the pointer! I can see from this thread that another PR has
>> been merged just over a month ago, to implement a ZEND_ARRAY_KEY_EXISTS
>> opcode to overcome the performance penalty of array_key_exists():
>> https://github.com/php/php-src/pull/3360
>>
>> Couldn't we broaden the scope of this opcode, or add a new one, to
>> support object properties?
>>
>
> We already have a function property_exists(). I don't know if it covers
> the case you want, though.
>
> Regards,
> --
> Rowan Collins
> [IMSoP]
>