array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'reflectionclass.hasconstant.php', 1 => 'ReflectionClass::hasConstant', ), 'up' => array ( 0 => 'class.reflectionclass.php', 1 => 'ReflectionClass', ), 'prev' => array ( 0 => 'reflectionclass.gettraits.php', 1 => 'ReflectionClass::getTraits', ), 'next' => array ( 0 => 'reflectionclass.hasmethod.php', 1 => 'ReflectionClass::hasMethod', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'tr', 'path' => 'reference/reflection/reflectionclass/hasconstant.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
ReflectionClass::hasConstant — Sabit tanımlı mı diye bakar
Belirtilen sabit tanımlıysa true
döner.
isim
Bakılacak sabitin ismi.
Örnek 1 - ReflectionClass::hasConstant() örneği
<?php
class Foo {
const c1 = 1;
}
$class = new ReflectionClass("Foo");
var_dump($class->hasConstant("c1"));
var_dump($class->hasConstant("c2"));
?>
Yukarıdaki örnek şuna benzer bir çıktı üretir:
bool(true) bool(false)