~/talk

Looping the Loop with SPL Iterators

Talkat phpday 2020 · on Tuesday, 2020-09-08· [php]
slides:none on file

SPL Iterators are shown to reduce complexity and improve readability by replacing arrays with iterable objects like IteratorAggregate that wrap a PDO statement and yield rows, effectively creating a rewindable generator by re-executing the query. Examples include nesting LimitIterator, CallbackFilterIterator, RegexIterator and filesystem iterators to build composable filters and infinite sequences; a concrete claim is that FixedArray saves about 20% less memory and iterators generally use far less memory than loading huge arrays, and the patterns demonstrated work as described.

AI-written summary · about

  1. 0:00Introduction
  2. 3:04What is an Iterator
  3. 5:36Array Iterator
  4. 9:06Real Code
  5. 13:30SPL Iterators
  6. 15:17Infinite Iterator
  7. 16:17Callback Iterator
  8. 18:33Generator Iterator
  9. 19:52Iterator Aggregate
  10. 22:51Useful Links
  11. 23:58Books
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.