interface_exists
(PHP 5 >= 5.0.2)
interface_exists — Checa se a interface foi definida
Descrição
bool interface_exists
( string $interface_name
[, bool $autoload
] )
Verifica se uma interface foi definida.
Parâmetros
- interface_name
-
O nome da interface.
- autoload
-
Se deve chamar __autoload ou não por padrão
Valor Retornado
Essa função retorna TRUE se a interface de nome interface_name já foi definida, FALSE caso contrário.
Exemplos
Example#1 Exemplo de uso de interface_exists()
<?php
// Check the interface exists before trying to use it
if (interface_exists('MyInterface')) {
class MyClass implements MyInterface
{
// Methods
}
}
?>