Difference between instanceof and is_subclass_of( ) : instanceof « Language Basics « PHP






Difference between instanceof and is_subclass_of( )

 
<?
    class Dog { }
    class Poodle extends Dog { }
    $poppy = new Poodle( );
    print (int)($poppy instanceof Poodle);
    print "\n";
    print (int)is_subclass_of($poppy, "Poodle");
?>
  
  








Related examples in the same category

1.Using the instanceof Operator