PHP Native Interfaces
PHP defines its own native interfaces. They are used with the native classes, and are usually available with custom code.
For example, Countable is a PHP native interface, which designates objects that can be passed to the count() function. On the other hand, Throwable is a native interface, which is characteristic of Exception and Error. It may be used for typing, with catch clauses, or with instanceof but must be implemented by extending the two former classes.
Native interfaces depend on the compiled extensions. Native interfaces are introduced in major or minor versions, so their number evolves with time.
<?php
print_r(get_declared_interfaces());
?>
See Also
Related
- Traversable
- IteratorAggregate
- Iterator
- Serializable
- ArrayAccess
- Countable Interface
- Stringable
- Throwable
- UnitEnum
- BackedEnum
- DateTimeInterface
- DOMParentNode
- DOMChildNode
- JsonSerializable
- RecursiveIterator
- OuterIterator
- SeekableIterator
- SplObserver
- SplSubject
- SessionHandlerInterface
- SessionIdInterface
- SessionUpdateTimestampHandlerInterface
- Reflector
- Random\CryptoSafeEngine
- Random\Engine