downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

is_a> <get_parent_class
Last updated: Fri, 20 May 2011

view this page in

interface_exists

(PHP 5 >= 5.0.2)

interface_existsComprueba si una interfaz ha sido definida

Descripción

bool interface_exists ( string $interface_name [, bool $autoload = true ] )

Comprueba si la interfaz dada ha sido definida.

Parámetros

interface_name

El nombre de la interfaz

autoload

Si llamar a __autoload o no por defecto.

Valores devueltos

Devuelve TRUE si la interfaz dada por interface_name ha sido definida, FALSE si no.

Ejemplos

Example #1 Ejemplo de interface_exists()

<?php
// Comprobar si la interfaz existe antes de intentar usarla
if (interface_exists('MiInterfaz')) {
    class 
MiClase implements MiInterfaz
    
{
        
// Métodos
    
}
}

?>

Ver también



add a note add a note User Contributed Notes interface_exists
andrey at php dot net 24-Oct-2004 11:40
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.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites