note 126007 added to reflectionproperty.getdefaultvalue
| From: | rwalker dot php at gmail dot com | Date: | Wed, 14 Apr 2021 13:49:06 +0000 |
| Subject: | note 126007 added to reflectionproperty.getdefaultvalue | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216281@lists.php.net to get a copy of this message | ||
An equivalent for PHP 7:
<?php
$reflectionProperty = new \ReflectionProperty(Foo::class, 'bar');
//PHP 8:
$defaultValue = $reflectionProperty->getDefaultValue();
//PHP 7:
$defaultValue =
$reflectionProperty->getDeclaringClass()->getDefaultProperties()['bar'] ?? null;
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 185.81.195.38)
----
Manual Page -- https://php.net/manual/en/reflectionproperty.getdefaultvalue.php
Edit -- https://main.php.net/note/edit/126007
Del: integrated -- https://main.php.net/note/delete/126007/integrated
Del: useless -- https://main.php.net/note/delete/126007/useless
Del: bad code -- https://main.php.net/note/delete/126007/bad+code
Del: spam -- https://main.php.net/note/delete/126007/spam
Del: non-english -- https://main.php.net/note/delete/126007/non-english
Del: in docs -- https://main.php.net/note/delete/126007/in+docs
Del: other reasons-- https://main.php.net/note/delete/126007
Reject -- https://main.php.net/note/reject/126007
Search -- https://main.php.net/manage/user-notes.php