The php Function Interface_Defined()
In PHP, you can create interfaces that define the methods a class must implement. This allows classes to be compatible with each other even if they use different underlying code. This is known as polymorphism. An interface can contain any number of methods, with the only requirement being that they must be public and must not have a body.
In a typical script, an implementing class will have a method that calls other methods in the interface it is extending. The php function is_interface_defined() returns TRUE if the class name (case insensitive) has been defined as an interface and FALSE otherwise. This function will also try to call __autoload by default, if it has not been explicitly disabled.
If you are creating an interface with methods that have sensitive parameter values, such as passwords and credentials, you may wish to protect the parameters’ value by adding an
In most object-oriented languages, class inheritance is used to allow a class to override the public and protected methods and properties of any class it extends. However, PHP does not support multiple inheritance, so instead you can simulate it using interfaces.
PHP offers three commonly used functions for checking variable existence and emptiness: isset(), empty(), and is_null(). By understanding these functions and using them appropriately, you can build more reliable and error-free PHP code.