downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

ReflectionClass::hasMethod> <ReflectionClass::getTraits
[edit] Last updated: Fri, 24 May 2013

view this page in

ReflectionClass::hasConstant

(PHP 5 >= 5.1.0)

ReflectionClass::hasConstantComprueba si una constante está o no definida

Descripción

public bool ReflectionClass::hasConstant ( string $name )

Comprueba si la constante especificada está o no definida en la clase.

Parámetros

name

Nombre de la constante que se desea comprobar.

Valores devueltos

TRUE si la constante está definida, y en cualquier otro caso FALSE.

Ejemplos

Ejemplo #1 Ejemplo de ReflectionClass::hasConstant()

<?php
class Foo {
    const 
c1 1;
}

$class = new ReflectionClass("Foo");

var_dump($class->hasConstant("c1"));
var_dump($class->hasConstant("c2"));
?>

El resultado del ejemplo sería algo similar a:

bool(true)
bool(false)

Ver también



add a note add a note User Contributed Notes ReflectionClass::hasConstant - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites