3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait AccessibleProperties { public function __isset($property) { return property_exists($this, $property); } public function __get($property) { if (property_exists($this, $property)) { return $this->$property; } } } class Fooba { use AccessibleProperties; protected $a = 'Some value'; } $foo = new Fooba; var_dump($foo->a); var_dump(isset($foo->a));

preferences:
57.76 ms | 402 KiB | 5 Q