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-- ReflectionObject::isInstance() - basic function test --FILE-- <?php class A {} cl..

Decoded Output download

--TEST--
ReflectionObject::isInstance() - basic function test
--FILE--
<?php
class A {}
class B extends A {}
class X {}

$classes = array("A", "B", "X");

$instances = array(	"myA" => new A,
                    "myB" => new B,
                    "myX" => new X );

foreach ($classes as $class) {
    $ro = new ReflectionObject(new $class);
    foreach ($instances as $name => $instance) {
        echo "is $name a $class? ";
        var_dump($ro->isInstance($instance));
    }
}

?>
--EXPECT--
is myA a A? bool(true)
is myB a A? bool(true)
is myX a A? bool(false)
is myA a B? bool(false)
is myB a B? bool(true)
is myX a B? bool(false)
is myA a X? bool(false)
is myB a X? bool(false)
is myX a X? bool(true)

Did this file decode correctly?

Original Code

--TEST--
ReflectionObject::isInstance() - basic function test
--FILE--
<?php
class A {}
class B extends A {}
class X {}

$classes = array("A", "B", "X");

$instances = array(	"myA" => new A,
                    "myB" => new B,
                    "myX" => new X );

foreach ($classes as $class) {
    $ro = new ReflectionObject(new $class);
    foreach ($instances as $name => $instance) {
        echo "is $name a $class? ";
        var_dump($ro->isInstance($instance));
    }
}

?>
--EXPECT--
is myA a A? bool(true)
is myB a A? bool(true)
is myX a A? bool(false)
is myA a B? bool(false)
is myB a B? bool(true)
is myX a B? bool(false)
is myA a X? bool(false)
is myB a X? bool(false)
is myX a X? bool(true)

Function Calls

None

Variables

None

Stats

MD5 29b0c746e743ad2e8c941d5b857ee073
Eval Count 0
Decode Time 84 ms