Tag

memory-efficient

1 views collected around this technical thread.

php中文网 Courses
php中文网 Courses
Nov 1, 2023 · Backend Development

Understanding PHP Generator Functions: Syntax, Use Cases, and Examples

This article explains PHP generator functions, covering their purpose for memory‑efficient data iteration, streaming, and asynchronous tasks, detailing their syntax with the yield statement, providing multiple code examples, outlining advantages, usage notes, and concluding with best‑practice recommendations.

asynchronousgeneratoriteration
0 likes · 5 min read
Understanding PHP Generator Functions: Syntax, Use Cases, and Examples
php中文网 Courses
php中文网 Courses
Dec 9, 2020 · Backend Development

Understanding PHP Generators and the yield Keyword

This article explains PHP's Generator feature introduced in version 5.5, demonstrating how the yield keyword enables memory‑efficient iteration, how to implement custom xrange functions, and how to control generators with methods like next, current, valid, send, rewind, and throw.

BackendIteratorgenerator
0 likes · 6 min read
Understanding PHP Generators and the yield Keyword