Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- Reflection and inheriting static properties --FILE-- <?php class base { stat..
Decoded Output download
--TEST--
Reflection and inheriting static properties
--FILE--
<?php
class base {
static protected $prop = 2;
static function show() {
echo __METHOD__ . '(' . self::$prop . ")
";
}
static function inc() {
base::$prop++;
echo __METHOD__ . "()
";
}
}
class derived extends base {
static public $prop = 2;
static function show() {
echo __METHOD__ . '(' . self::$prop . ")
";
}
static function inc() {
derived::$prop++;
echo __METHOD__ . "()
";
}
}
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()) . "
";
echo "Done
";
?>
--EXPECT--
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
Did this file decode correctly?
Original Code
--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";
?>
--EXPECT--
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
Function Calls
None |
Stats
MD5 | 956da589cb6d0397fe03424ba1b9709b |
Eval Count | 0 |
Decode Time | 89 ms |