File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
reflection /
tests /
static_properties_002.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:01 2012 UTC (13 years, 1 month 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--
Reflection and inheriting static properties
--FILE--
<?php
class base {
static protected $prop = 2;
static function show() {
echo __METHOD__ . '(' . self::$prop . ")\n";
}
static function inc() {
base::$prop++;
echo __METHOD__ . "()\n";
}
}
class derived extends base {
static public $prop = 2;
static function show() {
echo __METHOD__ . '(' . self::$prop . ")\n";
}
static function inc() {
derived::$prop++;
echo __METHOD__ . "()\n";
}
}
base::show();
derived::show();
base::inc();
base::show();
derived::show();
derived::inc();
base::show();
derived::show();
$r = new ReflectionClass('derived');
echo 'Number of properties: '. count($r->getStaticProperties()) . "\n";
echo "Done\n";
?>
--EXPECTF--
base::show(2)
derived::show(2)
base::inc()
base::show(3)
derived::show(2)
derived::inc()
base::show(3)
derived::show(3)
Number of properties: 1
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>