/ Published in: PHP
Comes in handy for php magic functions such as __get and __set. This behaviour is fixed in php 5.3. Returns true also for private and protected properties using a reflectionclass
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private function _property_exists_safe($class,$prop) { $r = property_exists($class, $prop); if (!$r) { $x = new ReflectionClass($class); $r = $x->hasProperty($prop); } return $r; }
URL: http://php.net/manual/en/function.property-exists.php