PHP/Reflection/get declared interfaces

Материал из Web эксперт
Перейти к: навигация, поиск

get_declared_interfaces( ) returns an array of all the interfaces currently available to you

   <source lang="html4strict">

<?

   interface Boat {
           function sink( );
           function scuttle( );
           function dock( );
   }
   interface Plane extends Boat {
           function takeoff( );
           function land( );
           function bailout( );
   }
   class Boatplane implements Plane {
           public function sink( ) { }
           public function scuttle( ) { }
           public function dock( ) { }
           public function takeoff( ) { }
           public function land( ) { }
           public function bailout( ) { }
   }
   $obj = new Boatplane( );

?>

 </source>
   
  


Listing Currently Loaded Interfaces and Classes

   <source lang="html4strict">

obtain lists of the interfaces and classes currently loaded with the functions get_declared_interfaces() and get_declared_classes(), respectively. <?

printf("

Interfaces currently available: %s

",

implode(", ", get_declared_interfaces()));

printf("

Classes currentlyavailable: %s

",

implode(", ", get_declared_classes())); ?>

 </source>