Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Class/Object Functions : interface_exists

interface_exists

Checks if the interface has been defined (PHP 5 >= 5.0.2)
bool interface_exists ( string interface_name [, bool autoload] )

Example 382. interface_exists() example

<?php
// Check the interface exists before trying to use it
if (interface_exists('MyInterface')) {
   class
MyClass implements MyInterface
   
{
       
// Methods
   
}
}

?>

Code Examples / Notes » interface_exists

andrey

As far as I remember interface_exists() was added in 5.0.2 . In 5.0.0 and 5.0.1 class_exists() used to return TRUE when asked for a existing interface. Starting 5.0.2 class_exists() doesn't do that anymore.

Change Language


Follow Navioo On Twitter
call_user_method_array
call_user_method
class_exists
get_class_methods
get_class_vars
get_class
get_declared_classes
get_declared_interfaces
get_object_vars
get_parent_class
interface_exists
is_a
is_subclass_of
method_exists
property_exists
eXTReMe Tracker