PHP - Function interface_exists()


Advertisements


Syntax

interface_exists ( $interface_name [, $autoload] );

Definition and Usage

This function checks if the given interface has been defined.

Parameters

Sr.No Parameter & Description
1

interface_name(Required)

The interface name

2

autoload(Optional)

Wether to call __autoload or not by default.

Return Value

It returns TRUE if the interface given by interface_name has been defined, FALSE otherwise.

Example

Following is the usage of this function −

<?php
   if (interface_exists('SomeInterface')) {
      class MyClass implements SomeInterface {
         // Methods
      }
   }
?> 

php_function_reference.htm

Advertisements