>
> 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.coll...@gmail.com> wrote:

> On Wed, 6 Feb 2019 at 15:21, Benjamin Morel <benjamin.mo...@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]
>

Reply via email to