<?php class Foo { private mixed $data; public function getData(): mixed { return $this->data; } public function setData(mixed $data): void { $this->data = $data; } } function my_isset(object $object, string $property): bool { $r = new ReflectionProperty($object::class, $property); return $r->isInitialized($object) && $r->getValue($object) !== null; } $foo = new Foo(); var_dump(my_isset($foo, 'data')); $foo->setData(42); var_dump(my_isset($foo, 'data')); // This does not actually work because the property is not accessible var_dump(isset($foo->data));
You have javascript disabled. You will not be able to edit any code.