File: 
 
[ELWIX - Embedded LightWeight unIX -] / 
embedaddon / 
php / 
ext / 
reflection / 
tests / 
ReflectionClass_hasConstant_001.phpt
 Revision 
1.1.1.1 (vendor branch): 
download - view: 
text, 
annotated - 
select for diffs - 
revision graph
Tue Feb 21 23:48:00 2012 UTC (13 years, 8 months ago) by 
misho
Branches: 
php,
MAIN
CVS tags: 
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
ReflectionClass::hasConstant()
--CREDITS--
Robin Fernandes <robinf@php.net>
Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
	const myConst = 1;
}
class D extends C {
}
$rc = new ReflectionClass("C");
echo "Check existing constant: ";
var_dump($rc->hasConstant("myConst"));
echo "Check existing constant, different case: ";
var_dump($rc->hasConstant("MyCoNsT"));
echo "Check absent constant: ";
var_dump($rc->hasConstant("doesntExist"));
$rd = new ReflectionClass("D");  
echo "Check inherited constant: ";
var_dump($rd->hasConstant("myConst"));
echo "Check absent constant: ";
var_dump($rd->hasConstant("doesntExist"));
?>
--EXPECTF--
Check existing constant: bool(true)
Check existing constant, different case: bool(false)
Check absent constant: bool(false)
Check inherited constant: bool(true)
Check absent constant: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>