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

search for in the

ReflectionClass::hasMethod> <ReflectionClass::getTraits
[edit] Last updated: Fri, 25 May 2012

view this page in

ReflectionClass::hasConstant

(PHP 5 >= 5.1.0)

ReflectionClass::hasConstant定数が定義されているかどうかを調べる

説明

public bool ReflectionClass::hasConstant ( string $name )

そのクラスで特定の定数が定義されているかどうかを調べます。

パラメータ

name

調べたい定数の名前。

返り値

定数が定義されている場合に TRUE、それ以外の場合に FALSE を返します。

例1 ReflectionClass::hasConstant() の例

<?php
class Foo {
    const 
c1 1;
}

$class = new ReflectionClass("Foo");

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

上の例の出力は、 たとえば以下のようになります。

bool(true)
bool(false)

参考



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

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