Exemplo n.º 1
0
        parent::anothermethod(1, 2);
        print "bar->onemethod: {$a} and {$b}\n";
    }
    function anothermethod($a, $b = 32)
    {
        parent::anothermethod(2, $b);
        print "bar->anothermethod: {$a} and {$b}\n";
    }
}
interface baz
{
    function bip();
}
new foo();
$b = new bar();
//foo::foo();
$b->onemethod(1);
$b->anothermethod(1);
echo get_class($b) . "\n";
echo get_parent_class($b) . "\n";
echo get_parent_class('bar') . "\n";
echo get_parent_class('stdClass') . "\n";
echo "subclass? " . is_subclass_of($b, 'foo') . "\n";
echo "subclass? " . is_subclass_of($a, 'foo') . "\n";
echo "subclass? " . is_subclass_of($a, 'stdclass') . "\n";
// this is > php 5.0.5
echo "subclass? " . is_subclass_of('bar', 'foo') . "\n";
echo "class_exists?" . class_exists('bar', false) . "\n";
echo "class_exists?" . class_exists('baz', false) . "\n";
echo "interface_exists?" . interface_exists('bar', false) . "\n";
echo "interface_exists?" . interface_exists('baz', false) . "\n";