note 112211 added to reflectionproperty.getdeclaringclass
| From: | metamarkers at gmail dot com | Date: | Fri, 17 May 2013 06:30:49 +0000 |
| Subject: | note 112211 added to reflectionproperty.getdeclaringclass | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194834@lists.php.net to get a copy of this message | ||
If you're reflecting an object and get the declaring class of a property that's set but
wasn't declared in any class, it returns the class of the instance.
<?php
class X {
}
$x = new X();
$x->foo = 'bar';
$reflection = new ReflectionObject($x);
echo $reflection->getProperty('foo')->getDeclaringClass()->getName(); // X
?>
----
Server IP: 69.147.83.199
Probable Submitter: 67.182.168.147
----
Manual Page -- http://php.net/manual/en/reflectionproperty.getdeclaringclass.php
Edit -- https://master.php.net/note/edit/112211
Del: integrated -- https://master.php.net/note/delete/112211/integrated
Del: useless -- https://master.php.net/note/delete/112211/useless
Del: bad code -- https://master.php.net/note/delete/112211/bad+code
Del: spam -- https://master.php.net/note/delete/112211/spam
Del: non-english -- https://master.php.net/note/delete/112211/non-english
Del: in docs -- https://master.php.net/note/delete/112211/in+docs
Del: other reasons-- https://master.php.net/note/delete/112211
Reject -- https://master.php.net/note/reject/112211
Search -- https://master.php.net/manage/user-notes.php