|
ReflectionProperty::__constructConstruct a ReflectionProperty object Description
public ReflectionProperty::__construct(objectstring
$class , string $property )Parameters
Errors/ExceptionsTrying to get or set private or protected class property's values will result in an exception being thrown. Examples
Example #1 ReflectionProperty::__construct example
The above example will output something similar to: ===> The public property 'length' (which was declared at compile-time) having the modifiers array ( 0 => 'public', ) ---> Value is: int(5) ---> Setting value to 10, new value is: int(10) object(Str)#2 (1) { ["length"]=> int(10) } Example #2 Getting value from private and protected properties using ReflectionProperty class
The above example will output something similar to: int(2) int(3) |