PHP 8.5.0 Alpha 1 available for testing

ReflectionProperty::isProtected

(PHP 5, PHP 7, PHP 8)

ReflectionProperty::isProtectedVerifica si la propiedad es protegida

Descripción

public ReflectionProperty::isProtected(): bool

Verifica si la propiedad es protegida.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

true si la propiedad es protegida, false en caso contrario.

Nota: Tenga en cuenta que esto se refiere únicamente a la visibilidad principal, y no a una visibilidad de definición, si está especificada.

Ver también

add a note

User Contributed Notes 1 note

up
2
Ievgen Iefimenko the_boss at bk dot ru
13 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