|
ReflectionProperty::__constructReflectionProperty オブジェクトを作成する 説明
public ReflectionProperty::__construct(objectstring
$class, string $property)パラメータ
エラー / 例外private あるいは protected なプロパティの値を取得あるいは設定しようとすると、 例外がスローされます。 例
例1 ReflectionProperty::__construct の例 上の例の出力は、 たとえば以下のようになります。
===> 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)
}
例2 ReflectionProperty クラスを用いた、private および protected プロパティの値の取得 上の例の出力は、 たとえば以下のようになります。 int(2) int(3) |