PHP 8.1.28 Released!

ReflectionProperty::isProtected

(PHP 5, PHP 7, PHP 8)

ReflectionProperty::isProtectedprotected プロパティであるかどうかを調べる

説明

public ReflectionProperty::isProtected(): bool

protected プロパティであるかどうかを調べます。

パラメータ

この関数にはパラメータはありません。

戻り値

protected プロパティである場合に true、それ以外の場合に false を返します。

参考

add a note

User Contributed Notes 1 note

up
2
Ievgen Iefimenko the_boss at bk dot ru
11 years ago
<?php

/**
* Return 1 if property is public,
* else return void
*/

class Classname{
private
$variable;
}

$obj = new Classname;
$rp = new ReflectionProperty($obj,'variable');
echo
$rp->isPrivate();
?>
To Top