PHP – Interfaces and predefined Classes
In this section, we will simply define what these are without further explanation, as they are predefined classes and interfaces commonly used without us noticing. For example, Throwable
is used with exceptions or Closure
when creating an anonymous function. If you are interested in any of these classes or interfaces, you can dive deeper into them at PHP.net manual.
Generator: Generator
objects are returned from generator functions.
Traversable: Interface for detecting if a class can be iterated over using foreach
.
Iterator: Interface for external iterators or objects that can be iterated internally by themselves.
IteratorAggregate: For creating an external Iterator
interface.
Throwable: Base interface for any object that can be thrown with a throw
statement in PHP 7, including Error
and Exception
.
ArrayAccess: Interface to provide access to objects as arrays.
Serializable: Interface for customizing serialization.
Closure: Class used to represent anonymous functions.
- Anterior: Excepciones predefinidas
- Siguiente: creando un directorio