What is the purpose of the php iterator?

searched the use of php iterator on the Internet for a day, several books are copy and paste, I hope php can answer, it is best to give the use of the scene, thank you very much!

Php
May.25,2021
The essence of the use of

iterators is to save memory overhead and improve performance.
columns such as pdo iterate over the query.
so traversing the pdo query result set has little memory overhead. But if you use a regular query, it may prompt you to exceed the memory capacity


for example, if you want to encapsulate an array class and implement an iterator, you can iterate like a native array in a loop statement. The same idea can be extended to any type that can be iterated.


can also be used to implement cooperative multi-task scheduling of php. For more information, please see
using cooperative programs to achieve multi-task scheduling in PHP

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb1025-2325.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb1025-2325.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?