Friend spotlight!
Whimsical Animations course
Friend spotlight!
NEW Whimsical Animations course
Friend spotlight! NEW Whimsical Animations course
huge discount only this week
Friend spotlight! Want to make your project stand out? NEW Whimsical Animations course huge discount only this week
Iterator

Iterator を PHP で

Iterator 振る舞いに関するデザインパターンの一つで 複雑なデータ構造の内部の詳細を公開することなく 順次横断的に探索することを可能とします

Iterator のおかげで クライアントは 異なるコレクション上の要素の探索を 単一のイテレーター・インターフェースを使用して同様の方法で行えます

複雑度

人気度

使用例 このパターンは PHP コードではよく見かけます 多くのフレームワークやライブラリーがこれを使用してコレクション上の探索の標準的方法を提供します

PHP には 組み込みの Iterator インターフェースがあり PHP のどのコードとも互換性のあるカスタム・イテレーターの構築に使えます

見つけ方 Iterator は nextprevious などの操舵そうだ用メソッドの存在から簡単に識別できます イテレーターを使ったクライアント・コードには 探索対象のコレクションへの直接のアクセスがないかもしれません

他言語での Iterator

Iterator を C# で Iterator を C++ で Iterator を Go で Iterator を Java で Iterator を Python で Iterator を Ruby で Iterator を Rust で Iterator を Swift で Iterator を TypeScript で