<?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));
You have javascript disabled. You will not be able to edit any code.