Home >Backend Development >PHP Tutorial >php—Traversable interface

php—Traversable interface

伊谢尔伦
伊谢尔伦Original
2016-11-22 11:05:561247browse

Introduction

An interface to detect whether a class can be traversed using foreach.

Basic abstract interface that cannot be implemented alone. Instead it must be implemented by the IteratorAggregate or Iterator interface.

Note:

Built-in classes that implement this interface can use foreach for traversal without implementing the IteratorAggregate or Iterator interface.

Note:

This is an internal engine interface that cannot be implemented in PHP scripts. The IteratorAggregate or Iterator interface can be used instead.

Interface summary

Traversable {

}

This interface does not have any methods, its role is only as the basic interface for all traversable classes.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn