English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Class/Object function reference manual
The interface_exists() function checks if the interface has been defined
interface_exists( $interface_name[, $autoload]);
This function checks if the given interface is already defined.
Serial number | Parameters and descriptions |
---|---|
1 | interface_name(Required) Interface name |
2 | autoload(Optional) Default whether to call __autoload. |
This function returns TRUE if the interface defined by interface_name is already defined, otherwise it returns FALSE.
Here is the usage of this function-
<?php // Check if the interface exists before trying to use it if (interface_exists('SomeInterface')) { class MyClass implements SomeInterface { // Method } } ?>