
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP Traversable Interface
Introduction
Traversable is an abstract interface, hence it can not be directly implemented by any class. Generally, Iterator or IteratorAggregate interfaces, which extend Traversable, are used to check if implementing class is traversable using foreach construct in PHP.
Certain built-in classes that implement this interface can be used in foreach and need not implement iterator interfaces. Since Traversable is an abstract interface, it doesn't have any methods in it.
Syntax
Traversable { // }
When implementing IteratorAggregate or Iterator interface which extends Traversable, they must be listed before its name in the implements clause.
Advertisements